code: def ttl(self, key):
          
          value = self.pttl(key)
          if value is None or value < 0:
              return value
          return value // 1000
docs: Emulate ttl
  
          Even though the official redis commands documentation at http://redis.io/commands/ttl
          states "Return value: Integer reply: TTL in seconds, -2 when key does not exist or -1
          when key does not have a timeout." the redis-py lib returns None for both these cases.
          The lib behavior has been emulated here.
  
          :param key: key for which ttl is requested.
          :returns: the number of seconds till timeout, None if the key does not exist or if the
                    key has no timeout(as per the redis-py lib behavior).