def ten_digit_to_comma_format(badge):
    """Returns the comma-format RFID number (without the comma) from the
    10-digit RFID number.

    Explanation:
    *On an EM4100/4001 spec RFID card, there will generally be two sets of
    numbers like this: 0015362878 234,27454
    *The part of the number before the comma represents the first hex byte of
    the "10 digit" number, and the second part is the last 2 hex bytes of the
    "10 digit" card number.
    *15362878 = EA6B3E
    *Splitting EA and 6B3E and converting them to decimal numbers will give
    you 234 and 27454 (the number with the comma on the card).
    *The comma is excluded in the return value because the controller does not
    need the comma.

    :param badge: 10-digit RFID card number, must be integer
    """
    # only the last 8 digits are the ID
    # the 8 digits correspond to only 6 hex values, so the max is FFFFFF
    if badge > 16777215:
        raise Exception("Error: Invalid RFID Number")
    formatted_id = str("{0:x}".format(badge)).zfill(6)  # converts to hex

    # splits the hex at first two and last 4, converts to dec,
    # then combines into string
    id_section_1 = str(int(formatted_id[:2], 16)).zfill(3)
    id_section_2 = str(int(formatted_id[-4:], 16)).zfill(5)
    return int(id_section_1 + id_section_2)