def _GetMimeType(file_name):
 extension_index = file_name.rfind('.')
 if (extension_index == (-1)):
  extension = ''
 else:
  extension = file_name[(extension_index + 1):].lower()
 if (extension in EXTENSION_BLACKLIST):
  raise InvalidAttachmentTypeError(('Extension %s is not supported.' % extension))
 mime_type = EXTENSION_MIME_MAP.get(extension, None)
 if (mime_type is None):
  mime_type = 'application/octet-stream'
 return mime_type

def _GetMimeType ( file_name ) : extension_index = file_name . rfind ( '.' ) if ( extension_index == ( - 1 ) ) : extension = '' else : extension = file_name [ ( extension_index + 1 ) : ] . lower ( ) if ( extension in EXTENSION_BLACKLIST ) : raise InvalidAttachmentTypeError ( ( 'Extension %s is not supported.' % extension ) ) mime_type = EXTENSION_MIME_MAP . get ( extension , None ) if ( mime_type is None ) : mime_type = 'application/octet-stream' return mime_type
determine mime-type from file name .