docs: def query(pattern_path, dict_, max_length=None, strip=False,
            case_sensitive=False, unique=False, deduplicate=False,
            string_transformations=None, hyperlink=False,
            return_multiple_columns=False):
      """Query the given dict with the given pattern path and return the result.
  
      The ``pattern_path`` is a either a single regular expression string or a
      list of regex strings that will be matched against the keys of the dict and
      its subdicts to find the value(s) in the dict to return.
  
      The returned result is either a single value (None, "foo", 42, False...)
      or (if the pattern path matched multiple values in the dict) a list of
      values.
  
      If the dict contains sub-lists or sub-dicts values from these will be
      flattened into a simple flat list to be returned.
  
      """
      if string_transformations is None:
          string_transformations = []
  
      if max_length:
          string_transformations.append(lambda x: x[:max_length])
  
      if hyperlink:
          string_transformations.append(
              lambda x: '=HYPERLINK("{0}")'.format(x))
  
      if isinstance(pattern_path, basestring):
          pattern_path = [pattern_path]
  
      # Copy the pattern_path because we're going to modify it which can be
      # unexpected and confusing to user code.
      original_pattern_path = pattern_path
      pattern_path = pattern_path[:]
  
      # We're going to be popping strings off the end of the pattern path
      # (because Python lists don't come with a convenient pop-from-front method)
      # so we need the list in reverse order.
      pattern_path.reverse()
  
      result = _process_object(pattern_path, dict_,
                               string_transformations=string_transformations,
                               strip=strip, case_sensitive=case_sensitive,
                               return_multiple_columns=return_multiple_columns)
  
      if not result:
          return None  # Empty lists finally get turned into None.
      elif isinstance(result, dict):
          return _flatten(result)
      elif len(result) == 1:
          return result[0]  # One-item lists just get turned into the item.
      else:
          if unique:
              msg = "pattern_path: {0}\n\n".format(original_pattern_path)
              msg = msg + pprint.pformat(dict_)
              raise UniqueError(msg)
          if deduplicate:
              # Deduplicate the list while maintaining order.
              new_result = []
              for item in result:
                  if item not in new_result:
                      new_result.append(item)
              result = new_result
          return result