def ifexpr(fpredicate, ftrue, ffalse, arg):
    """Functional if expression.

    Args:
      fpredicate: true/false function on arg
      ftrue: run if fpredicate is true with arg
      ffalse: run if fpredicate is false with arg
      arg: the arg to run on the functions

    Returns:
      the result of either ftrue or ffalse
    """
    if fpredicate(arg):
        return ftrue(arg)
    else:
        return ffalse(arg)