def _analyze_indexed_fields(indexed_fields):
result = {}<EOL>for field_name in indexed_fields:<EOL><INDENT>if not isinstance(field_name, basestring):<EOL><INDENT>raise TypeError('<STR_LIT>' % (field_name,))<EOL><DEDENT>if '<STR_LIT:.>' not in field_name:<EOL><INDENT>if field_name in result:<EOL><INDENT>raise ValueError('<STR_LIT>' % field_name)<EOL><DEDENT>result[field_name] = None<EOL><DEDENT>else:<EOL><INDENT>head, tail = field_name.split('<STR_LIT:.>', <NUM_LIT:1>)<EOL>if head not in result:<EOL><INDENT>result[head] = [tail]<EOL><DEDENT>elif result[head] is None:<EOL><INDENT>raise ValueError('<STR_LIT>' %<EOL>(field_name, head))<EOL><DEDENT>else:<EOL><INDENT>result[head].append(tail)<EOL><DEDENT><DEDENT><DEDENT>return result<EOL>
Internal helper to check a list of indexed fields.

    Args:
      indexed_fields: A list of names, possibly dotted names.

    (A dotted name is a string containing names separated by dots,
    e.g. 'foo.bar.baz'.  An undotted name is a string containing no
    dots, e.g. 'foo'.)

    Returns:
      A dict whose keys are undotted names.  For each undotted name in
      the argument, the dict contains that undotted name as a key with
      None as a value.  For each dotted name in the argument, the dict
      contains the first component as a key with a list of remainders as
      values.

    Example:
      If the argument is ['foo.bar.baz', 'bar', 'foo.bletch'], the return
      value is {'foo': ['bar.baz', 'bletch'], 'bar': None}.

    Raises:
      TypeError if an argument is not a string.
      ValueError for duplicate arguments and for conflicting arguments
        (when an undotted name also appears as the first component of
        a dotted name).