def hset(
        self,
        name: KeyT,
        key: Optional[FieldT] = None,
        value: Optional[EncodableT] = None,
        mapping: Optional[Mapping[AnyFieldT, EncodableT]] = None,
    ) -> Awaitable:
        """
        Set ``key`` to ``value`` within hash ``name``,
        ``mapping`` accepts a dict of key/value pairs that that will be
        added to hash ``name``.
        Returns the number of fields that were added.
        """
        if key is None and not mapping:
            raise DataError("'hset' with no key value pairs")
        items: List[Union[FieldT, Optional[EncodableT]]] = []
        if key is not None:
            items.extend((key, value))
        if mapping:
            for pair in mapping.items():
                items.extend(pair)

        return self.execute_command("HSET", name, *items)

        Set ``key`` to ``value`` within hash ``name``,
        ``mapping`` accepts a dict of key/value pairs that that will be
        added to hash ``name``.
        Returns the number of fields that were added.
        
aioredis/client.py