code: def close_connection (self):
          
          if self.url_connection is None:
              # no connection is open
              return
          try:
              self.url_connection.close()
          except Exception:
              # ignore close errors
              pass
          self.url_connection = None
docs: Close an opened url connection.