async def send_packed_command(
        self,
        command: Union[bytes, str, Iterable[bytes]],
        check_health: bool = True,
    ):
        """Send an already packed command to the Redis server"""
        if not self._writer:
            await self.connect()
        # guard against health check recursion
        if check_health:
            await self.check_health()
        try:
            if isinstance(command, str):
                command = command.encode()
            if isinstance(command, bytes):
                command = [command]
            await asyncio.wait_for(
                self._send_packed_command(command),
                self.socket_timeout,
            )
        except asyncio.TimeoutError:
            await self.disconnect()
            raise TimeoutError("Timeout writing to socket") from None
        except OSError as e:
            await self.disconnect()
            if len(e.args) == 1:
                err_no, errmsg = "UNKNOWN", e.args[0]
            else:
                err_no = e.args[0]
                errmsg = e.args[1]
            raise ConnectionError(
                f"Error {err_no} while writing to socket. {errmsg}."
            ) from e
        except BaseException:
            await self.disconnect()
            raise
Send an already packed command to the Redis server
aioredis/connection.py