def get_peer(self): addr, port = address_parser.get_ip(self.req),\ address_parser.get_port(self.req) if address_parser.is_valid_ipv4(addr): return Address(type=Address.TCP4, host=addr, port=port) if address_parser.is_valid_ipv6(addr): return Address(type=Address.TCP6, host=addr, port=port)