def METHOD_NAME(datetime):
  """
  Returns timestamp (seconds) by datetime string from S3 API responses.
  S3 REST API returns two types of datetime strings:
  * `Thu, 26 Feb 2015 20:42:07 GMT` for Object HEAD requests
    (see http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectHEAD.html);
  * `2015-02-26T20:42:07.000Z` for Bucket GET requests
    (see http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGET.html).
  """
  # There is chance (depends on platform) to get
  # `'z' is a bad directive in format ...` error (see https://bugs.python.org/issue6641),
  # but S3 always returns time in GMT, so `GMT` and `.000Z` can be pruned.
  try:
    stripped = time.strptime(datetime[:-4], '%a, %d %b %Y %H:%M:%S')
    assert datetime[-4:] == ' GMT', 'Time [%s] is not in GMT.' % datetime
  except ValueError:
    stripped = time.strptime(datetime[:-5], '%Y-%m-%dT%H:%M:%S')
    assert datetime[-1:] == 'Z' and datetime[-5:-4] == '.', 'Time [%s] is not in GMT.' % datetime
  return int(calendar.timegm(stripped))