code: def check_md5(
      url: str, dest_paths: List[Path], headers: Optional[dict] = None
  ) -> bool:
      url_md5 = path_set_md5(url)
  
      try:
          if url_md5.startswith("s3://"):
              import boto3
  
              s3 = boto3.resource("s3")
              bucket, key = url_md5[5:].split("/", maxsplit=1)
              obj = s3.Object(bucket, key)
              data = obj.get()["Body"].read().decode("utf8")
          else:
              r = requests.get(url_md5, headers=headers)
              if r.status_code != 200:
                  return False
              data = r.text
      except Exception as e:
          log.debug(
              f"Could not download {url_md5} because of an exception {type(e)}: {e}"
          )
          return False
  
      expected = {}
      for line in data.splitlines():
          _md5, fname = line.split(" ", maxsplit=1)
          if fname[0] != "*":
              if fname[0] == " ":
                  log.warning(
                      f"Hash generated in text mode for {fname}, comparison could be incorrect"
                  )
              else:
                  log.error(
                      f'Unknown hash content format in {url + ".md5"}'
                  )
                  return False
          expected[fname[1:]] = _md5
  
      done = None
      not_done = []
      for base_path in dest_paths:
          if all(
              file_md5(base_path / p) == _md5
              for p, _md5 in expected.items()
          ):
              done = base_path
          else:
              not_done.append(base_path)
  
      if done is None:
          return False
  
      for base_path in not_done:
          log.info(f"Copying data from {done} to {base_path}")
          for p in expected.keys():
              shutil.copy(done / p, base_path / p)
      return True
  
imports: import secrets
  import shutil
  import sys
  from argparse import ArgumentParser, Namespace
  from collections import defaultdict
  from logging import getLogger
  from pathlib import Path
  from typing import Union, Optional, Dict, Iterable, Set, Tuple, List
  from urllib.parse import urlparse
  import requests
  from filelock import FileLock
  import deeppavlov
  from deeppavlov.core.commands.utils import expand_path, parse_config
  from deeppavlov.core.data.utils import download, download_decompress, get_all_elems_from_json, file_md5, set_query_parameter, path_set_md5, get_download_token
label_desc: Use image node_id 3 for calling a global function with example usage: check_md5(url, dest_paths, headers) and returns: True, False, False, False, False