def METHOD_NAME(tarinfo):
    if gid is not None:
        tarinfo.gid = gid
        tarinfo.gname = group
    if uid is not None:
        tarinfo.uid = uid
        tarinfo.uname = owner
    return tarinfo