@classmethod<EOL><INDENT>def parse(cls, gvid, exception=True):<DEDENT>
if gvid == '<STR_LIT>':<EOL><INDENT>return cls.get_class('<STR_LIT:null>')(<NUM_LIT:0>)<EOL><DEDENT>if not bool(gvid):<EOL><INDENT>return None<EOL><DEDENT>if not isinstance(gvid, six.string_types):<EOL><INDENT>raise TypeError("<STR_LIT>".format(type(gvid)))<EOL><DEDENT>try:<EOL><INDENT>if not cls.sl:<EOL><INDENT>if six.PY3:<EOL><INDENT>fn = cls.decode<EOL><DEDENT>else:<EOL><INDENT>fn = cls.decode.__func__<EOL><DEDENT>sl = fn(gvid[<NUM_LIT:0>:cls.sl_width])<EOL><DEDENT>else:<EOL><INDENT>sl = cls.sl  <EOL><DEDENT><DEDENT>except ValueError as e:<EOL><INDENT>if exception:<EOL><INDENT>raise ValueError("<STR_LIT>".format(gvid, str(e)))<EOL><DEDENT>else:<EOL><INDENT>return cls.get_class('<STR_LIT:null>')(<NUM_LIT:0>)<EOL><DEDENT><DEDENT>try:<EOL><INDENT>cls = cls.sl_map[sl]<EOL><DEDENT>except KeyError:<EOL><INDENT>if exception:<EOL><INDENT>raise ValueError("<STR_LIT>".format(gvid, sl))<EOL><DEDENT>else:<EOL><INDENT>return cls.get_class('<STR_LIT:null>')(<NUM_LIT:0>)<EOL><DEDENT><DEDENT>m = cls.regex.match(gvid)<EOL>if not m:<EOL><INDENT>raise ValueError("<STR_LIT>".format(gvid, cls.regex_str))<EOL><DEDENT>d = m.groupdict()<EOL>if not d:<EOL><INDENT>return None<EOL><DEDENT>if six.PY3:<EOL><INDENT>fn = cls.decode<EOL><DEDENT>else:<EOL><INDENT>fn = cls.decode.__func__<EOL><DEDENT>d = {k: fn(v) for k, v in d.items()}<EOL>try:<EOL><INDENT>del d['<STR_LIT>']<EOL><DEDENT>except KeyError:<EOL><INDENT>pass<EOL><DEDENT>return cls(**d)<EOL>
Parse a string value into the geoid of this class.

:param gvid: String value to parse.
:param exception: If true ( default) raise an eception on parse erorrs. If False, return a
'null' geoid.
:return: