Modular invariants and twisted equivariant K-theory