def METHOD_NAME(dep, configs):
  '''
  :param dep: name of a dependency
  :param configs: a dict from dep_urls_py.yaml
  :return: boolean
  It downloads files form urls to a temp directory first in order to avoid
  to deal with any temp files. It helps keep clean final directory.
  '''
  if dep in configs:
    config = configs[dep]
    dest_dir = os.path.join(LICENSE_DIR, dep)
    cur_temp_dir = tempfile.mkdtemp()
    try:
      if config['license'] == 'skip':
        print('Skip pulling license for ', dep)
      else:
        url_read = urlopen(Request(config['license'],
                                   headers={'User-Agent': 'Apache Beam'}))
        with open(cur_temp_dir + '/LICENSE', 'wb') as temp_write:
          shutil.copyfileobj(url_read, temp_write)
        logging.debug(
            'Successfully pulled license for {dep} from {url}.'.format(
                dep=dep, url=config['license']))
      # notice is optional.
      if 'notice' in config:
        url_read = urlopen(config['notice'])
        with open(cur_temp_dir + '/NOTICE', 'wb') as temp_write:
          shutil.copyfileobj(url_read, temp_write)
      shutil.copytree(cur_temp_dir, dest_dir)
      return True
    except Exception as e:
      logging.error(
          'Error occurred when pull license for {dep} from {url}.'.format(
              dep=dep, url=config))
      traceback.print_exc()
      raise
    finally:
      shutil.rmtree(cur_temp_dir)