import unittest


def xfail(condition):
    """Mark a test that's expected to fail for a given condition."""

    def inner(func):
        if condition:
            return unittest.expectedFailure(func)

        else:
            return func

    return inner