def get_versions(context, return_stable=False):
  """
  Get all versions of a key
  Args:
    context: a populated EFVersionContext object
    return_stable: (default:False) If True, stop fetching if 'stable' version is found; return only that version
  Returns:
    json list of object data sorted in reverse by last_modified (newest version is first). Each item is a dict:
    {
      'value': <value>,
      'last_modified": <YYYY-MM-DDThh:mm:ssZ>, (ISO8601 date time string)
      'modified_by': '<arn:aws:...>',
      'version_id': '<version_id>',
      'status': See EF_Config.S3_VERSION_STATUS_* for possible values
    }
  """
  s3_key = "{}/{}/{}".format(context.service_name, context.env, context.key)
  object_version_list = context.aws_client("s3").list_object_versions(
      Bucket=EFConfig.S3_VERSION_BUCKET,
      Delimiter='/',
      MaxKeys=context.limit,
      Prefix=s3_key
  )
  if "Versions" not in object_version_list:
    return []
  object_versions = []
  for version in object_version_list["Versions"]:
    object_version = Version(context.aws_client("s3").get_object(
        Bucket=EFConfig.S3_VERSION_BUCKET,
        Key=s3_key,
        VersionId=version["VersionId"]
    ))
    # Stop if a stable version was found and return_stable was set
    if return_stable and object_version.status == EFConfig.S3_VERSION_STATUS_STABLE:
      return [object_version]
    object_versions.append(object_version)

  # If caller is looking for a 'stable' version and we made it to here, a stable version was not found
  if return_stable:
    return []
  else:
    return sorted(object_versions, key=lambda v: v.last_modified, reverse=True)
Get all versions of a key
  Args:
    context: a populated EFVersionContext object
    return_stable: (default:False) If True, stop fetching if 'stable' version is found; return only that version
  Returns:
    json list of object data sorted in reverse by last_modified (newest version is first). Each item is a dict:
    {
      'value': <value>,
      'last_modified": <YYYY-MM-DDThh:mm:ssZ>, (ISO8601 date time string)
      'modified_by': '<arn:aws:...>',
      'version_id': '<version_id>',
      'status': See EF_Config.S3_VERSION_STATUS_* for possible values
    }