import asyncio class utils: @staticmethod async def read_line_safe(reader): """ Simple implementation to read a line from an async reader Mimics the original read_line_safe functionality """ try: line = await reader.readline() return line.decode().strip() except Exception: return None def log_error(e, client_writer=None): """ Basic error logging function """ print(f"Error occurred: {e}") if client_writer: try: client_writer.write(f"Error: {str(e)}\n".encode()) except Exception: print("Could not send error to client")