new_contents: import socket
  import ast
  
  class Server(object):
  
    backlog = 5
    client = None
  
    def __init__(self, host, port):
      self.socket = socket.socket()
      self.socket.bind((host, port))
      self.socket.listen(self.backlog)
  
    def __del__(self):
      self.close()
  
    def accept(self):
      # if a client is already connected, disconnect it
      if self.client:
        self.client.close()
      self.client, self.client_addr = self.socket.accept()
      return self
  
    def send(self, data):
      if not self.client:
        raise Exception('Cannot send data, no client is connected')
      _send(self.client, data)
      return self
  
    def recv(self):
      if not self.client:
        raise Exception('Cannot receive data, no client is connected')
      return _recv(self.client)
  
    def close(self):
      if self.client:
        self.client.close()
        self.client = None
      if self.socket:
        self.socket.close()
        self.socket = None
  
  class Client(object):
  
    socket = None
  
    def __del__(self):
      self.close()
  
    def connect(self, host, port):
      self.socket = socket.socket()
      self.socket.connect((host, port))
      return self
  
    def send(self, data):
      if not self.socket:
        raise Exception('You have to connect first before sending data')
      _send(self.socket, data)
      return self
  
    def recv(self):
      if not self.socket:
        raise Exception('You have to connect first before receiving data')
      return _recv(self.socket)
  
    def recv_and_close(self):
      data = self.recv()
      self.close()
      return data
  
    def close(self):
      if self.socket:
        self.socket.close()
        self.socket = None
  
  def _send(socket, data):
    socket.sendall(str(data).encode('utf8'))
  
  def _recv(socket):
      data = socket.recv(4096)
      data = ast.literal_eval(data)
      return data
  
subject: Create Networking.py