import logging


def _resolve_promise_to_id_list(promise):
  """Given an object that might be a promise or an ID list, return IDs."""
  if type(promise) == list:
    logging.info('got list %r', promise)
    return promise  # Which is actually an ID list.
  else:
    key_list = promise.get_result()
    id_list = [k.integer_id() for k in key_list]
    logging.info('got promise that yielded %r', id_list)
    return id_list