docs: def _simplify(elements):
          """Simplifies and normalizes the list of elements removing
          redundant/repeated elements and normalising upper/lower case
          so case sensitivity is resolved here."""
          simplified = []
          previous = None
          for element in elements:
              if element == "..":
                  raise FormicError("Invalid glob:"
                                    " Cannot have '..' in a glob: {0}".format(
                                        "/".join(elements)))
              elif element == ".":
                  # . in a path does not do anything
                  pass
              elif element == "**" and previous == "**":
                  # Remove repeated "**"s
                  pass
              else:
                  simplified.append(os.path.normcase(element))
                  previous = element
  
          if simplified[-1] == "":
              # Trailing slash shorthand for /**
              simplified[-1] = "**"
  
          # Ensure the pattern either:
          #  * Starts with a "**", or
          #  * Starts with the first real element of the glob
          if simplified[0] == "":
              # "" means the pattern started with a slash.
              del simplified[0]
          else:
              if simplified[0] != "**":
                  simplified.insert(0, "**")
  
          return simplified