def once(dispatcher, event, handle, *args):
    """
    Used to do a mapping like event -> handle
    but handle is called just once upon event.
    """

    def shell(dispatcher, *args):
        try:
            handle(dispatcher, *args)
        except Exception as e:
            raise e
        finally:
            dispatcher.del_map(event, shell)
    dispatcher.add_map(event, shell, *args)
def once ( dispatcher , event , handle , * args ) : def shell ( dispatcher , * args ) : try : handle ( dispatcher , * args ) except Exception as e : raise e finally : dispatcher . del_map ( event , shell ) dispatcher . add_map ( event , shell , * args )
Used to do a mapping like event -> handle
    but handle is called just once upon event.