def _get_prop_from_modelclass(modelclass, name):
if name == '<STR_LIT>':<EOL><INDENT>return modelclass._key<EOL><DEDENT>parts = name.split('<STR_LIT:.>')<EOL>part, more = parts[<NUM_LIT:0>], parts[<NUM_LIT:1>:]<EOL>prop = modelclass._properties.get(part)<EOL>if prop is None:<EOL><INDENT>if issubclass(modelclass, model.Expando):<EOL><INDENT>prop = model.GenericProperty(part)<EOL><DEDENT>else:<EOL><INDENT>raise TypeError('<STR_LIT>' %<EOL>(modelclass._get_kind(), part))<EOL><DEDENT><DEDENT>while more:<EOL><INDENT>part = more.pop(<NUM_LIT:0>)<EOL>if not isinstance(prop, model.StructuredProperty):<EOL><INDENT>raise TypeError('<STR_LIT>' %<EOL>(modelclass._get_kind(), part))<EOL><DEDENT>maybe = getattr(prop, part, None)<EOL>if isinstance(maybe, model.Property) and maybe._name == part:<EOL><INDENT>prop = maybe<EOL><DEDENT>else:<EOL><INDENT>maybe = prop._modelclass._properties.get(part)<EOL>if maybe is not None:<EOL><INDENT>prop = getattr(prop, maybe._code_name)<EOL><DEDENT>else:<EOL><INDENT>if issubclass(prop._modelclass, model.Expando) and not more:<EOL><INDENT>prop = model.GenericProperty()<EOL>prop._name = name  <EOL><DEDENT>else:<EOL><INDENT>raise KeyError('<STR_LIT>' %<EOL>(prop._modelclass._get_kind(), part))<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return prop<EOL>
Helper for FQL parsing to turn a property name into a property object.

    Args:
      modelclass: The model class specified in the query.
      name: The property name.  This may contain dots which indicate
        sub-properties of structured properties.

    Returns:
      A Property object.

    Raises:
      KeyError if the property doesn't exist and the model clas doesn't
      derive from Expando.