def check_preconditions(f, args, kwargs):
    """ Runs all of the preconditions. """
    f = getattr(f, 'wrapped_fn', f)
    if f and hasattr(f, 'preconditions'):
        for cond in f.preconditions:
            cond(args, kwargs)