def parse_crc32(crc32):
    """Checks for crc32 validity and makes it an uppercase str."""

    # If crc32 comes from the patch file, perform int to str conversion
    if isinstance(crc32, int):
        crc32 = hex(crc32).lstrip("0x")

    # Make crc32 uppercase, empty it if isn't valid hex of len 8
    if isinstance(crc32, str):
        if len(crc32) != 8:
            crc32 = ""
        else:
            crc32 = crc32.upper()

            try:
                crc32 = crc32.upper()
                int(crc32, 16)
            except ValueError:
                crc32 = ""

    return crc32