import json


def GetDownloadSerializationData(src_obj_metadata, progress=0):
  """Returns download serialization data.

  There are four entries:
    auto_transfer: JSON-specific field, always False.
    progress: How much of the download has already been completed.
    total_size: Total object size.
    url: Implementation-specific field used for saving a metadata get call.
         For JSON, this the download URL of the object.
         For XML, this is a pickled boto key.

  Args:
    src_obj_metadata: Object to be downloaded.
    progress: See above.

  Returns:
    Serialization data for use with Cloud API GetObjectMedia.
  """

  serialization_dict = {
      'auto_transfer': 'False',
      'progress': progress,
      'total_size': src_obj_metadata.size,
      'url': src_obj_metadata.mediaLink
  }

  return json.dumps(serialization_dict)