def parse_creation(creation_string):
  """Parses creation string from header format.

  Parse creation date of the format:

    YYYY-mm-dd HH:MM:SS.ffffff

    Y: Year
    m: Month (01-12)
    d: Day (01-31)
    H: Hour (00-24)
    M: Minute (00-59)
    S: Second (00-59)
    f: Microsecond

  Args:
    creation_string: String creation date format.

  Returns:
    datetime object parsed from creation_string.

  Raises:
    CreationFormatError when the creation string is formatted incorrectly.
  """

  def split(string, by, count):
    result = string.split(by, count)
    if len(result) != count + 1:
      raise CreationFormatError(
          'Could not parse creation %s.' % creation_string)
    return result

  timestamp_string, microsecond = split(creation_string, '.', 1)

  try:
    timestamp = time.strptime(timestamp_string, BASE_CREATION_HEADER_FORMAT)
    microsecond = int(microsecond)
  except __HOLE__:
    raise CreationFormatError('Could not parse creation %s.' % creation_string)

  return datetime.datetime(*timestamp[:6] + tuple([microsecond]))
dataset/ETHPy150Open CollabQ/CollabQ/.google_appengine/google/appengine/api/blobstore/blobstore.py/parse_creation