code: def remove_broken_links(dpath, verbose=True):
      
      fname_list = [join(dpath, fname) for fname in os.listdir(dpath)]
      broken_links = list(filterfalse(exists, filter(islink, fname_list)))
      num_broken = len(broken_links)
      if verbose:
          if verbose > 1 or num_broken > 0:
              print('[util_path] Removing %d broken links in %r' % (num_broken, dpath,))
      for link in broken_links:
          os.unlink(link)
      return num_broken
docs: Removes all broken links in a directory
  
      Args:
          dpath (str):  directory path
  
      Returns:
          int: num removed
  
      References:
          http://stackoverflow.com/questions/20794/find-broken-symlinks-with-python
  
      CommandLine:
          python -m utool remove_broken_links:0
  
      Example:
          >>> # DISABLE_DOCTEST
          >>> # SCRIPT
          >>> from utool.util_path import *  # NOQA
          >>> remove_broken_links('.')
  
      Example:
          >>> # ENABLE_DOCTEST
          >>> from utool.util_path import *  # NOQA
          >>> import utool as ut
          >>> dpath = ut.ensure_app_resource_dir('utool', 'path_tests')
          >>> ut.delete(dpath)
          >>> test_dpath = ut.ensuredir(join(dpath, 'testdpath'))
          >>> test_fpath = ut.ensurefile(join(dpath, 'testfpath.txt'))
          >>> flink1 = ut.symlink(test_fpath, join(dpath, 'flink1'))
          >>> dlink1 = ut.symlink(test_fpath, join(dpath, 'dlink1'))
          >>> assert len(ut.ls(dpath)) == 4
          >>> ut.delete(test_fpath)
          >>> assert len(ut.ls(dpath)) == 3
          >>> remove_broken_links(dpath)
          >>> ut.delete(test_dpath)
          >>> remove_broken_links(dpath)
          >>> assert len(ut.ls(dpath)) == 0