         [{:maps, :get, [_, map], _} | _] -> map
         _ -> nil
       end
+
     %KeyError{key: key, term: term}
   end
 

  end

  defp format_sup_spec({:invalid_child_spec, child_spec}) do
   "invalid child specification: #{inspect child_spec}"
  end

  defp format_sup_spec({:invalid_child_type, type}) do
    "invalid child type: #{inspect type}. Must be :worker or :supervisor."
  end

  defp format_sup_spec({:invalid_mfa, mfa}) do
    "invalid mfa: #{inspect mfa}"
  end

  defp format_sup_spec({:invalid_restart_type, restart}) do
    "invalid restart type: #{inspect restart}. Must be :permanent, :transient or :temporary."
  end

  defp format_sup_spec({:invalid_shutdown, shutdown}) do
    "invalid shutdown: #{inspect shutdown}. Must be an integer >= 0, :infinity or :brutal_kill."
  end

  defp format_sup_spec({:invalid_module, mod}) do
    "invalid module: #{inspect mod}. Must be an atom."
  end

  defp format_sup_spec({:invalid_modules, modules}) do
    "invalid modules: #{inspect modules}. Must be a list of atoms or :dynamic."
  end

  defp format_sup_spec(other), do: "got: #{inspect other}"

  @doc """
  Receives a stacktrace entry and formats it into a string.
  """
  @spec format_stacktrace_entry(stacktrace_entry) :: String.t
  def format_stacktrace_entry(entry)

  # From Macro.Env.stacktrace

    case exception do
      %{function: nil} ->
        "no function clause matches"

      %{module: module, function: function, arity: arity} ->
        formatted = Exception.format_mfa(module, function, arity)
        blamed = blame(exception, &inspect/1, &blame_match/2)
        "no function clause matching in #{formatted}" <> blamed
    end
  end

  defp blame_match(%{match?: true, node: node}, _), do: Macro.to_string(node)
  defp blame_match(%{match?: false, node: node}, _), do: "-" <> Macro.to_string(node) <> "-"
  defp blame_match(_, string), do: string

  @doc false
  def blame(%{args: nil}, _, _) do
    ""
  end

  def blame(
        %{
          module: module,
          function: function,
          arity: arity,
          kind: kind,
          args: args,
          clauses: clauses
        },
        inspect_fun,
        ast_fun
      ) do
    mfa = Exception.format_mfa(module, function, arity)

    formatted_args =
