code: def test_get_url_granular(tmp_dir, dvc, cloud):
      tmp_dir.add_remote(config=cloud.config)
      tmp_dir.dvc_gen(
          {
              "dir": {
                  "foo": "foo",
                  "bar": "bar",
                  "nested": {"file": "file"},
              }
          }
      )
  
      expected_url = (
          cloud
          / "files"
          / "md5"
          / "5f"
          / "c28ea78987408341668eba6525ebd1.dir"
      ).url
      assert api.get_url("dir") == expected_url
  
      expected_url = (
          cloud
          / "files"
          / "md5"
          / "ac"
          / "bd18db4cc2f85cedef654fccc4a4d8"
      ).url
      assert api.get_url("dir/foo") == expected_url
  
      expected_url = (
          cloud
          / "files"
          / "md5"
          / "37"
          / "b51d194a7513e45b56f6524f2d51f2"
      ).url
      assert api.get_url("dir/bar") == expected_url
  
      expected_url = (
          cloud
          / "files"
          / "md5"
          / "8c"
          / "7dd922ad47494fc02c388e12c00eac"
      ).url
      assert (
          api.get_url(os.path.join("dir", "nested", "file"))
          == expected_url
      )
  
imports: import os
  import pytest
  from funcy import first, get_in
  from dvc import api
  from dvc.exceptions import OutputNotFoundError, PathMissingError
  from dvc.testing.api_tests import TestAPI
  from dvc.testing.tmp_dir import make_subrepo
  from dvc.utils.fs import remove
label_desc: Use image node_id 11 for calling a global function with example usage: test_get_url_granular(tmp_dir, dvc, cloud) without return types