def METHOD_NAME(excluded_testcase=None):
  """Copies contents of global blacklist into local blacklist file, excluding
  a particular testcase (if any)."""
  lsan_suppressions_path = get_local_blacklist_file_path()
  excluded_function_name = (
      get_leak_function_for_blacklist(excluded_testcase)
      if excluded_testcase else None)
  with open(lsan_suppressions_path, 'w') as local_blacklist:
    # Insert comment on top to avoid parsing errors on empty file.
    local_blacklist.write(LSAN_HEADER_COMMENT)
    # Copy global blacklist into local blacklist.
    global_blacklists = data_types.Blacklist.query(
        data_types.Blacklist.tool_name == LSAN_TOOL_NAME)
    blacklisted_functions = []
    for blacklist in global_blacklists:
      if blacklist.function_name in blacklisted_functions:
        continue
      if blacklist.function_name == excluded_function_name:
        continue
      local_blacklist.write(
          LSAN_SUPPRESSION_LINE.format(function=blacklist.function_name))
      blacklisted_functions.append(blacklist.function_name)