def parse229(resp, peer):
 if (resp[:3] != '229'):
  raise error_reply(resp)
 left = resp.find('(')
 if (left < 0):
  raise error_proto(resp)
 right = resp.find(')', (left + 1))
 if (right < 0):
  raise error_proto(resp)
 if (resp[(left + 1)] != resp[(right - 1)]):
  raise error_proto(resp)
 parts = resp[(left + 1):right].split(resp[(left + 1)])
 if (len(parts) != 5):
  raise error_proto(resp)
 host = peer[0]
 port = int(parts[3])
 return (host, port)

def parse229 ( resp , peer ) : if ( resp [ : 3 ] != '229' ) : raise error_reply ( resp ) left = resp . find ( '(' ) if ( left < 0 ) : raise error_proto ( resp ) right = resp . find ( ')' , ( left + 1 ) ) if ( right < 0 ) : raise error_proto ( resp ) if ( resp [ ( left + 1 ) ] != resp [ ( right - 1 ) ] ) : raise error_proto ( resp ) parts = resp [ ( left + 1 ) : right ] . split ( resp [ ( left + 1 ) ] ) if ( len ( parts ) != 5 ) : raise error_proto ( resp ) host = peer [ 0 ] port = int ( parts [ 3 ] ) return ( host , port )
parse the 229 response for an epsv request .