def parse227(resp):
 if (resp[:3] != '227'):
  raise error_reply, resp
 global _227_re
 if (_227_re is None):
  import re
  _227_re = re.compile('(\\d+),(\\d+),(\\d+),(\\d+),(\\d+),(\\d+)')
 m = _227_re.search(resp)
 if (not m):
  raise error_proto, resp
 numbers = m.groups()
 host = '.'.join(numbers[:4])
 port = ((int(numbers[4]) << 8) + int(numbers[5]))
 return (host, port)

def parse227 ( resp ) : if ( resp [ : 3 ] != '227' ) : raise error_reply , resp global _227_re if ( _227_re is None ) : import re _227_re = re . compile ( '(\\d+),(\\d+),(\\d+),(\\d+),(\\d+),(\\d+)' ) m = _227_re . search ( resp ) if ( not m ) : raise error_proto , resp numbers = m . groups ( ) host = '.' . join ( numbers [ : 4 ] ) port = ( ( int ( numbers [ 4 ] ) << 8 ) + int ( numbers [ 5 ] ) ) return ( host , port )
parse the 227 response for a pasv request .