def resolve_media_files(document, resource):
 for field in resource_media_fields(document, resource):
  if isinstance(document[field], list):
   resolved_list = []
   for file_id in document[field]:
    resolved_list.append(resolve_one_media(file_id, resource))
   document[field] = resolved_list
  else:
   document[field] = resolve_one_media(document[field], resource)

def resolve_media_files ( document , resource ) : for field in resource_media_fields ( document , resource ) : if isinstance ( document [ field ] , list ) : resolved_list = [ ] for file_id in document [ field ] : resolved_list . append ( resolve_one_media ( file_id , resource ) ) document [ field ] = resolved_list else : document [ field ] = resolve_one_media ( document [ field ] , resource )
embed media files into the response document .