code: def close_socket(sock):
      '''Shutdown and close the socket.'''
      if sock:
          try:
              sock.shutdown(socket.SHUT_RDWR)
          except Exception:
              pass
          try:
              sock.close()
          except Exception:
              pasf close_socket(sock):
      '''Shutdown and close the socket.'''
      if sock:
          try:
              sock.shutdown(socket.SHUT_RDWR)
          except Exception:
              pass
          try:
              sock.close()
          except Exception:
              pass
docs: Shutdown and close the socket.