def close_room(room, namespace=None):
    """Close a room.

    This function removes any users that are in the given room and then deletes
    the room from the server.

    :param room: The name of the room to close.
    :param namespace: The namespace for the room. If not provided, the
                      namespace is obtained from the request context.
    """
    socketio = flask.current_app.extensions['socketio']
    namespace = namespace or flask.request.namespace
    socketio.server.close_room(room, namespace=namespace)