code: def resolve_ptr(tor_endpoint, ip):
      
      if six.PY2 and isinstance(ip, str):
          ip = unicode(ip)  # noqa
      elif six.PY3 and isinstance(ip, bytes):
          ip = ip.decode('ascii')
      factory = _TorSocksFactory(
          ip, 0, 'RESOLVE_PTR', None,
      )
      proto = yield tor_endpoint.connect(factory)
      result = yield proto.when_done()
      returnValue(result)
docs: This is easier to use via :meth:`txtorcon.Tor.dns_resolve_ptr`
  
      :param tor_endpoint: the Tor SOCKS endpoint to use.
  
      :param ip: the IP address to look up.