def _build_field_type_map(base_class):
mapping = {}<EOL>for cls in _get_recursive_subclasses(base_class):<EOL><INDENT>if cls.field_type:<EOL><INDENT>if isinstance(cls.field_type, tuple):<EOL><INDENT>for field_type in cls.field_type:<EOL><INDENT>mapping[field_type] = cls<EOL><DEDENT><DEDENT>elif isinstance(cls.field_type, _string_types):<EOL><INDENT>mapping[cls.field_type] = cls<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>'.format(<EOL>type(cls.field_type),<EOL>cls<EOL>))<EOL><DEDENT><DEDENT><DEDENT>return mapping<EOL>
Create mapping from all $type values to their respective Field classes