def handler_ix(dest: list, el) -> int:
  """Returns the index of element in dest, with some app.yaml awareness.
  
  Specifically, it checks if el has the attributes of an handler and if it
  does, it will consider two elements to be the same and override one another
  if they have the same url and apply the same strategy to serve files.

  This is important as - for a given url - there can only be a single
  handler, so the configurations need to be merged.
  """
  if not isinstance(el, dict) or not "url" in el:
    try:
      return dest.index(el)
    except ValueError:
      return -1

  for ix, existing in enumerate(dest):
    # See docstring for explanation. Tl;Dr: one url config overrides
    # another if the url is the same, and if both configs are static_files
    # or both configs are static_dir.
    # A static_dir and a static_files entry can coexist for the same
    # even if they refer to the same url.
    if ("url" in existing and existing["url"] == el["url"] and
        (("static_dir" in existing and "static_dir" in el) or
         ("static_files" in existing and "static_files" in el))):
      return ix

  return -1