code: def dict_query(dic, query):
      
  
      if not isinstance(query, six.string_types):
          raise ValueError("query must be a string, not %r" % type(query))
  
      def _browse(tokens, d):
          """ Recurse through a dict to retrieve a value. """
          current, rest = tokens[0], tokens[1:]
  
          if not rest:
              return d.get(current, None)
  
          if current in d:
              if isinstance(d[current], dict):
                  return _browse(rest, d[current])
              elif rest:
                  return None
              else:
                  return d[current]
  
      keys = [key.strip().split('.') for key in query.split(',')]
      return OrderedDict([
          ('.'.join(tokens), _browse(tokens, dic)) for tokens in keys
      ])
docs: Query a dict with 'dotted notation'.  Returns an OrderedDict.
  
      A query of "foo.bar.baz" would retrieve 'wat' from this::
  
          dic = {
              'foo': {
                  'bar': {
                      'baz': 'wat',
                  }
              }
          }
  
      Multiple queries can be specified if comma-separated.  For instance, the
      query "foo.bar.baz,foo.bar.something_else" would return this::
  
          OrderedDict({
              "foo.bar.baz": "wat",
              "foo.bar.something_else": None,
          })