code: def tar_archive(context):
      
      logger.debug("start")
  
      mode = get_file_mode_for_writing(context)
  
      for item in context['tar']['archive']:
          # value is the destination tar. Allow string interpolation.
          destination = context.get_formatted_string(item['out'])
          # key is the source to archive
          source = context.get_formatted_string(item['in'])
          with tarfile.open(destination, mode) as archive_me:
              logger.debug(f"Archiving '{source}' to '{destination}'")
  
              archive_me.add(source, arcname='.')
              logger.info(f"Archived '{source}' to '{destination}'")
  
      logger.debug("end")
docs: Archive specified path to a tar archive.
  
      Args:
          context: dictionary-like. context is mandatory.
              context['tar']['archive'] must exist. It's a dictionary.
              keys are the paths to archive.
              values are the destination output paths.
  
      Example:
          tar:
              archive:
                  - in: path/to/dir
                    out: path/to/destination.tar.xs
                  - in: another/my.file
                    out: ./my.tar.xs
  
          This will archive directory path/to/dir to path/to/destination.tar.xs,
          and also archive file another/my.file to ./my.tar.xs