import math


def get_number(value):
    """Convert any number format-able thing to int or float"""
    try:
        v = int(value)
        if v == float(value):
            return v
    except (TypeError, ValueError):
        pass

    try:
        v = float(value)
        if not math.isnan(value):
            return v
    except (TypeError, ValueError):
        pass