def teardown_socket(s):
  """Shuts down and closes a socket."""
  try:
    s.shutdown(socket.SHUT_WR)
  except socket.error:
    pass
  finally:
    s.close()
def teardown_socket ( s ) : try : s . shutdown ( socket . SHUT_WR ) except socket . error : pass finally : s . close ( )
Shuts down and closes a socket.