Function body is nested too deep

I have a case statement that is failing in credo. Giving me this error

“Function body is nested too deep” I know we can use “with” here but I’m failing to use it correctly

  case NaiveDateTime.from_iso8601(valid_time) do
      {:ok, datetime} ->
        case Somefunction(which give me true or false) do
          true -> true
          false -> false
        end

      {:error, _} ->
        "datetime is not valid"
    end

Guide me