<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _detect_content_type(self, content, encoding):
 """This method tries to auto-detect the type of the data. It first tries to see if the data is a valid integer, in which case it returns numeric. Next, it tests the data to see if it is 'alphanumeric.' QR Codes use a special table with very limited range of ASCII characters. The code's data is tested to make sure it fits inside this limited range. If all else fails, the data is determined to be of type 'binary.' Returns a tuple containing the detected mode and encoding. Note, encoding ECI is not yet implemented. """

        def two_bytes(c):
            """Output two byte character code as a single integer."""
            def next_byte(b):
                """Make sure that character code is an int. Python 2 and
                3 compatibility.
                """
                if not isinstance(b, int):
                    return ord(b)
                else:
                    return b

            #Go through the data by looping to every other character
            for i in range(0, len(c), 2):
                yield (next_byte(c[i]) << 8) | next_byte(c[i+1])

        #See if the data is a number
        try:
            if str(content).isdigit():
                return 'numeric', encoding
        except (TypeError, UnicodeError):
            pass

        #See if that data is alphanumeric based on the standards
        #special ASCII table
        valid_characters = ''.join(tables.ascii_codes.keys())
        
        #Force the characters into a byte array
        valid_characters = valid_characters.encode('ASCII')

        try:
            if isinstance(content, bytes):
                c = content.decode('ASCII')
            else:
                c = str(content).encode('ASCII')

            if all(map(lambda x: x in valid_characters, c)):
                return 'alphanumeric', 'ASCII'

        #This occurs if the content does not contain ASCII characters.
        #Since the whole point of the if statement is to look for ASCII
        #characters, the resulting mode should not be alphanumeric.
        #Hence, this is not an error.
        except TypeError:
            pass
        except UnicodeError:
            pass

        try:
            if isinstance(content, bytes):
                if encoding is None:
                    encoding = 'shiftjis'

                c = content.decode(encoding).encode('shiftjis')
            else:
                c = content.encode('shiftjis')
            
            #All kanji characters must be two bytes long, make sure the
            #string length is not odd.
            if len(c) % 2 != 0:
                return 'binary', encoding

            #Make sure the characters are actually in range.
            for asint in two_bytes(c):
                #Shift the two byte value as indicated by the standard
                if not (0x8140 <= asint <= 0x9FFC or
                        0xE040 <= asint <= 0xEBBF):
                    return 'binary', encoding

            return 'kanji', encoding

        except UnicodeError:
            #This occurs if the content does not contain Shift JIS kanji
            #characters. Hence, the resulting mode should not be kanji.
            #This is not an error.
            pass

        #All of the other attempts failed. The content can only be binary.
        return 'binary', encoding