def _GenerateFilter(params):
  """Generate a filter object using dot separated object paths.

  A list of dot separated paths (foo, foo.bar, foo.baz) is merged into a
  dict which can be used as a filter on a received object.  Objects are parsed
  until a falsy value (such as {}) is reached which includes everything inside
  that part of the object.  Missing values in a dict at a given level are
  excluded.  Currently arrays are not filtered and array indices should simply
  be excluded in a path.

  Args:
    params: List of object paths to filter on.

  Returns:
    A dict which can be matched up with fields in a received object.
  """
  filt = {}
  for param in params:
    path = filt
    for token in param.split('.'):
      if token not in path:
        path[token] = {}
      path = path[token]
  return filt