code: def pttl(self, key):
          
          """
          Returns time to live in milliseconds if output_ms is True, else returns seconds.
          """
          key = self._encode(key)
          if key not in self.redis:
              # as of redis 2.8, -2 is returned if the key does not exist
              return long(-2) if self.strict else None
          if key not in self.timeouts:
              # as of redis 2.8, -1 is returned if the key is persistent
              # redis-py returns None; command docs say -1
              return long(-1) if self.strict else None
  
          time_to_live = get_total_milliseconds(self.timeouts[key] - self.clock.now())
          return long(max(-1, time_to_live))
docs: Emulate pttl
  
          :param key: key for which pttl is requested.
          :returns: the number of milliseconds till timeout, None if the key does not exist or if the
                    key has no timeout(as per the redis-py lib behavior).