def METHOD_NAME(func):
    """
    Decorator which marks a pytest benchmark function with "submit_result_to_codespeed" marker.
    """
    # NOTE: functools.wraps doesn't work well enough under Python 2 so we need to use decorator
    # package
    def wrapped_function(func, *args, **kwargs):
        if isinstance(args[0], BenchmarkFixture):
            benchmark = args[0]
        elif "benchmark" in kwargs:
            benchmark = kwargs["benchmark"]
        else:
            raise ValueError('Unable to detect "benchmark" kwarg')
        benchmark.METHOD_NAME = True
        return func(*args, **kwargs)
    return decorator.decorator(wrapped_function, func)