code: def chmod(self, tarinfo, targetpath):
          
          if hasattr(os, 'chmod'):
              try:
                  os.chmod(targetpath, tarinfo.mode)
              except EnvironmentError as e:
                  raise ExtractError("could not change mode")
docs: Set file permissions of targetpath according to tarinfo.