def GetQueryFields(referenced_fields, prefix):
  """Returns the comma separated list of field names referenced by the command.

  Args:
    referenced_fields: A list of field names referenced by the format and filter
      expressions.
    prefix: The referenced field name resource prefix.

  Returns:
    The comma separated list of field names referenced by the command.
  """
  if not referenced_fields:
    return None
  return ','.join(['nextPageToken'] +
                  ['.'.join([prefix, field]) for field in referenced_fields])