def calculate_keys_by_mapreduce_state(cls, mapreduce_state):
    if mapreduce_state is None:
      return []
    keys = []
    for i in range(mapreduce_state.mapreduce_spec.mapper.shard_count):
      shard_id = cls.shard_id_from_number(mapreduce_state.key().name(), i)
      keys.append(cls.get_key_by_shard_id(shard_id))
    return keys