code: def setex(self, name, time, value):
          
          if isinstance(time, datetime.timedelta):
              time = int(time.total_seconds())
          return self.execute_command('SETEX', name, time, value)
docs: Set the value of key ``name`` to ``value`` that expires in ``time``
          seconds. ``time`` can be represented by an integer or a Python
          timedelta object.