from functools import reduce


def compose(*args):
    """ Composes argument functions and returns resulting function;
        e.g. compose(f, g)(x) == f(g(x)) """
    return reduce(lambda f, g: lambda x: f(g(x)), args, lambda x: x)