Decorator for making sure a method can only be executed once

def run_once(func):
    ''' Decorator for making sure a method can only be executed once '''
    def wrapper(*args, **kwargs):
        if not wrapper.has_run:
            wrapper.has_run = True
            return func(*args, **kwargs)
    wrapper.has_run = False
    return wrapper