from typing import Any
import fractions


def fractional(value: Any) -> Any:
    """Returns a human readable fractional number.

    The return can be in the form of fractions and mixed fractions.
    There will be some cases where one might not want to show ugly decimal
    places for floats and decimals.

    Pass in a string, or a number or a float, and this function returns
        a string representation of a fraction
        or whole number
        or a mixed fraction

    Examples:
        fractional(0.3) will return '1/3'
        fractional(1.3) will return '1 3/10'
        fractional(float(1/3)) will return '1/3'
        fractional(1) will return '1'

    This will always return a string.

    Args:
        value: a number.

    Returns:
        Any: human readable number.
    """
    try:
        number = float(value)
    except (TypeError, ValueError):
        return value
    whole_number = int(number)
    frac = fractions.Fraction(number - whole_number).limit_denominator(1000)
    numerator = frac.numerator
    denominator = frac.denominator
    if whole_number and not numerator and denominator == 1:
        # this means that an integer was passed in
        # or variants of that integer like 1.0000
        return "%.0f" % whole_number
    if not whole_number:
        return "%.0f/%.0f" % (numerator, denominator)
    return "%.0f %.0f/%.0f" % (whole_number, numerator, denominator)