code: def get_canonical_headers(headers):
      
      if headers is None:
          headers = []
      elif isinstance(headers, dict):
          headers = list(headers.items())
  
      if not headers:
          return [], []
  
      normalized = collections.defaultdict(list)
      for key, val in headers:
          key = key.lower().strip()
          val = MULTIPLE_SPACES.sub(" ", val.strip())
          normalized[key].append(val)
  
      ordered_headers = sorted((key, ",".join(val)) for key, val in normalized.items())
  
      canonical_headers = ["{}:{}".format(*item) for item in ordered_headers]
      return canonical_headers, ordered_headers
docs: Canonicalize headers for signing.
  
      See:
      https://cloud.google.com/storage/docs/access-control/signed-urls#about-canonical-extension-headers
  
      :type headers: Union[dict|List(Tuple(str,str))]
      :param headers:
          (Optional) Additional HTTP headers to be included as part of the
          signed URLs.  See:
          https://cloud.google.com/storage/docs/xml-api/reference-headers
          Requests using the signed URL *must* pass the specified header
          (name and value) with each request for the URL.
  
      :rtype: str
      :returns: List of headers, normalized / sortted per the URL refernced above.