def hmset(self, name, mapping):
        """
        Set key to value within hash ``name`` for each corresponding
        key and value from the ``mapping`` dict.
        """
        if not mapping:
            raise DataError("'hmset' with 'mapping' of length 0")
        items = []
        for pair in iteritems(mapping):
            items.extend(pair)
        return self.execute_command('HMSET', name, *items)

        Set key to value within hash ``name`` for each corresponding
        key and value from the ``mapping`` dict.
        
stackoverflow/venv/lib/python3.6/site-packages/redis/client.py