def encode_udp_packet(rsv, frag, address_type, address, port, payload):
 strings = [struct.pack('!HBB', rsv, frag, address_type), __encode_address(address_type, address), struct.pack('!H', port), payload]
 return ''.join(strings)

def encode_udp_packet ( rsv , frag , address_type , address , port , payload ) : strings = [ struct . pack ( '!HBB' , rsv , frag , address_type ) , __encode_address ( address_type , address ) , struct . pack ( '!H' , port ) , payload ] return '' . join ( strings )
encodes a socks5 udp packet .