def _split_mime_type(mime_type):
  """Split MIME type into main type and subtype.

  Args:
    mime_type: The full MIME type string.

  Returns:
    (main, sub):
      main: Main part of MIME type (e.g., application, image, text, etc).
      sub: Subtype part of MIME type (e.g., pdf, png, html, etc).

  Raises:
    _InvalidMIMETypeFormatError: mime_type is incorrectly formatted.
  """
  if mime_type:
    match = _MIME_PATTERN.match(mime_type)
    if not match:
      raise _InvalidMIMETypeFormatError(
          'Incorrectly formatted MIME type: %s' % mime_type)
    return match.groups()
  else:
    return 'application', 'octet-stream'
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/devappserver2/blob_upload.py/_split_mime_type/original