def detect(text):
if sys.version_info < (<NUM_LIT:3>, <NUM_LIT:0>):<EOL><INDENT>try:<EOL><INDENT>text = text.decode('<STR_LIT:utf-8>')<EOL><DEDENT>except UnicodeError:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>for L in text:<EOL><INDENT>code = ord(L)<EOL>if code >= BRAHMIC_FIRST_CODE_POINT:<EOL><INDENT>for name, start_code in BLOCKS:<EOL><INDENT>if start_code <= code <= BRAHMIC_LAST_CODE_POINT:<EOL><INDENT>return name<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if Regex.IAST_OR_KOLKATA_ONLY.search(text):<EOL><INDENT>if Regex.KOLKATA_ONLY.search(text):<EOL><INDENT>return Scheme.Kolkata<EOL><DEDENT>else:<EOL><INDENT>return Scheme.IAST<EOL><DEDENT><DEDENT>if Regex.ITRANS_ONLY.search(text):<EOL><INDENT>return Scheme.ITRANS<EOL><DEDENT>if Regex.SLP1_ONLY.search(text):<EOL><INDENT>return Scheme.SLP1<EOL><DEDENT>if Regex.VELTHUIS_ONLY.search(text):<EOL><INDENT>return Scheme.Velthuis<EOL><DEDENT>if Regex.ITRANS_OR_VELTHUIS_ONLY.search(text):<EOL><INDENT>return Scheme.ITRANS<EOL><DEDENT>return Scheme.HK<EOL>
Detect the input's transliteration scheme.

      :param text: some text data, either a `unicode` or a `str` encoded
                   in UTF-8.