def process_multipart(entity):
 ib = u''
 if (u'boundary' in entity.content_type.params):
  ib = entity.content_type.params['boundary'].strip(u'"')
 if (not re.match(u'^[ -~]{0,200}[!-~]$', ib)):
  raise ValueError((u'Invalid boundary in multipart form: %r' % (ib,)))
 ib = (u'--' + ib).encode('ascii')
 while True:
  b = entity.readline()
  if (not b):
   return
  b = b.strip()
  if (b == ib):
   break
 while True:
  part = entity.part_class.from_fp(entity.fp, ib)
  entity.parts.append(part)
  part.process()
  if part.fp.done:
   break

def process_multipart ( entity ) : ib = u'' if ( u'boundary' in entity . content_type . params ) : ib = entity . content_type . params [ 'boundary' ] . strip ( u'"' ) if ( not re . match ( u'^[ -~]{0,200}[!-~]$' , ib ) ) : raise ValueError ( ( u'Invalid boundary in multipart form: %r' % ( ib , ) ) ) ib = ( u'--' + ib ) . encode ( 'ascii' ) while True : b = entity . readline ( ) if ( not b ) : return b = b . strip ( ) if ( b == ib ) : break while True : part = entity . part_class . from_fp ( entity . fp , ib ) entity . parts . append ( part ) part . process ( ) if part . fp . done : break
read all multipart parts into entity .