def try_to_num(in_str):
    """
    Convert string to a number if possible.

    :param: in_str
    :return: int, float, or original string
    """
    for f in (int, float):
        try:
            return f(in_str)
        except ValueError as e:
            pass
    return in_str