code: def checkCopyright(f, update_current_year):
      """Checks for copyright headers and their years."""
      errs = []
      thisYear = datetime.datetime.now().year
      lineNum = 0
      crFound = False
      yearMatched = False
  
      if isinstance(f, git.Diff):
          path = f.b_path
          lines = (
              f.b_blob.data_stream.read()
              .decode()
              .splitlines(keepends=True)
          )
      else:
          path = f
          with open(f, encoding="utf-8") as fp:
              lines = fp.readlines()
  
      for line in lines:
          lineNum += 1
          start, end = getCopyrightYears(line)
          if start is None:
              continue
          crFound = True
          if start > end:
              e = [
                  path,
                  lineNum,
                  "First year after second year in the copyright "
                  "header (manual fix required)",
                  None,
              ]
              errs.append(e)
          elif thisYear < start or thisYear > end:
              e = [
                  path,
                  lineNum,
                  "Current year not included in the copyright header",
                  None,
              ]
              if thisYear < start:
                  e[-1] = replaceCurrentYear(line, thisYear, end)
              if thisYear > end:
                  e[-1] = replaceCurrentYear(line, start, thisYear)
              errs.append(e)
          else:
              yearMatched = True
      # copyright header itself not found
      if not crFound:
          e = [
              path,
              0,
              "Copyright header missing or formatted incorrectly "
              "(manual fix required)",
              None,
          ]
          errs.append(e)
      # even if the year matches a copyright header, make the check pass
      if yearMatched:
          errs = []
  
      if update_current_year:
          errs_update = [x for x in errs if x[-1] is not None]
          if len(errs_update) > 0:
              lines_changed = ", ".join(str(x[1]) for x in errs_update)
              print(f"File: {path}. Changing line(s) {lines_changed}")
              for _, lineNum, __, replacement in errs_update:
                  lines[lineNum - 1] = replacement
              with open(path, "w", encoding="utf-8") as out_file:
                  out_file.writelines(lines)
  
      return errs
  
file_path: cudf/ci/checks/copyright.py
imports: import argparse
  import datetime
  import os
  import re
  import sys
  import git
label_desc: Use image node_id 5 for calling a global function with example usage: checkCopyright(f, update_current_year) and returns: errs