def _build_casefold_map(self):
self._casefold_map = defaultdict(dict)<EOL>filename = "<STR_LIT>"<EOL>current_dir = os.path.abspath(os.path.dirname(__file__))<EOL>with codecs.open(os.path.join(current_dir, filename), mode="<STR_LIT:r>", encoding="<STR_LIT:utf-8>") as fp:<EOL><INDENT>for line in fp:<EOL><INDENT>if not line.strip() or line.startswith("<STR_LIT:#>"):<EOL><INDENT>continue  <EOL><DEDENT>code, status, mapping, name = line.split("<STR_LIT:;>")<EOL>src = _hexstr_to_unichr(code)<EOL>target = u"<STR_LIT>".join([_hexstr_to_unichr(c) for c in mapping.strip().split()])<EOL>self._casefold_map[status.strip()][src] = target<EOL><DEDENT><DEDENT>
Function for parsing the case folding data from the Unicode Character
Database (UCD) and generating a lookup table.  For more info on the UCD,
see the following website: https://www.unicode.org/ucd/