code: def update_router(self, router, name=None, admin_state_up=None, **kwargs):
          '''
          Updates a router
          '''
          router_id = self._find_router_id(router)
          body = {}
  
          if 'ext_network' in kwargs:
              if kwargs.get('ext_network') is None:
                  body['external_gateway_info'] = None
              else:
                  net_id = self._find_network_id(kwargs.get('ext_network'))
                  body['external_gateway_info'] = {'network_id': net_id}
          if name is not None:
              body['name'] = name
          if admin_state_up is not None:
              body['admin_state_up'] = admin_state_up
          return self.network_conn.update_router(
              router=router_id, body={'router': body}f update_router(self, router, name=None, admin_state_up=None, **kwargs):
          '''
          Updates a router
          '''
          router_id = self._find_router_id(router)
          body = {}
  
          if 'ext_network' in kwargs:
              if kwargs.get('ext_network') is None:
                  body['external_gateway_info'] = None
              else:
                  net_id = self._find_network_id(kwargs.get('ext_network'))
                  body['external_gateway_info'] = {'network_id': net_id}
          if name is not None:
              body['name'] = name
          if admin_state_up is not None:
              body['admin_state_up'] = admin_state_up
          return self.network_conn.update_router(
              router=router_id, body={'router': body})
docs: Updates a router