def _SplitMIMEType(mime_type):
 if mime_type:
  mime_type_array = mime_type.split('/')
  if (len(mime_type_array) == 1):
   raise InvalidMIMETypeFormatError('Missing MIME sub-type.')
  elif (len(mime_type_array) == 2):
   (main_type, sub_type) = mime_type_array
   if (not (main_type and sub_type)):
    raise InvalidMIMETypeFormatError(('Incorrectly formatted MIME type: %s' % mime_type))
   return (main_type, sub_type)
  else:
   raise InvalidMIMETypeFormatError(('Incorrectly formatted MIME type: %s' % mime_type))
 else:
  return ('application', 'octet-stream')

def _SplitMIMEType ( mime_type ) : if mime_type : mime_type_array = mime_type . split ( '/' ) if ( len ( mime_type_array ) == 1 ) : raise InvalidMIMETypeFormatError ( 'Missing MIME sub-type.' ) elif ( len ( mime_type_array ) == 2 ) : ( main_type , sub_type ) = mime_type_array if ( not ( main_type and sub_type ) ) : raise InvalidMIMETypeFormatError ( ( 'Incorrectly formatted MIME type: %s' % mime_type ) ) return ( main_type , sub_type ) else : raise InvalidMIMETypeFormatError ( ( 'Incorrectly formatted MIME type: %s' % mime_type ) ) else : return ( 'application' , 'octet-stream' )
split mime-type in to main and sub type .