def int2mac(integer, upper=False):
    """
    Convert a integer value into a mac address
    :param integer: Integer value of potential mac address
    :param upper: True if you want get address with uppercase
    :return: String mac address in format AA:BB:CC:DD:EE:FF
    """

    def format_int():
        return zip(*[iter("{:012x}".format(integer))] * 2)

    if type(integer).__name__ not in ("int", "long"):
        # hack: since in the python3, long is not supported
        raise TypeError("Value %s is not a number" % integer)

    if integer < 0 or integer > 281474976710655:
        raise ValueError("Value %s is out of the range of MAC" % integer)

    mac = ":".join(["{}{}".format(a, b) for a, b in format_int()])
    if upper:
        return mac.upper()
    return mac