from typing import Union


def numify(variable: str) -> Union[int, float, str]:
    """Attempts to convert 'variable' to a numeric type.
    
    If 'variable' cannot be converted to a numeric type, it is returned as is.

    Args:
        variable (str): variable to be converted.

    Returns
        variable (int, float, str) converted to numeric type, if possible.

    """
    try:
        return int(variable)
    except ValueError:
        try:
            return float(variable)
        except ValueError:
            return variable