def calc_mode(
        sticky=False,
        isuid=True,
        isgid=True,
        type=stat.S_IFREG,
        owner_read=True,
        owner_write=True,
        owner_exec=True,
        group_read=True,
        group_write=True,
        group_exec=True,
        other_read=True,
        other_write=True,
        other_exec=True,
):
    """helper function to calculate the mode bits of a file."""
    mode = 0
    if owner_read:
        mode |= stat.S_IRUSR
    if owner_write:
        mode |= stat.S_IWUSR
    if owner_exec:
        mode |= stat.S_IXUSR
    if group_read:
        mode |= stat.S_IRGRP
    if group_write:
        mode |= stat.S_IWGRP
    if group_exec:
        mode |= stat.S_IXGRP
    if other_read:
        mode |= stat.S_IROTH
    if other_write:
        mode |= stat.S_IWOTH
    if other_exec:
        mode |= stat.S_IXOTH
    if sticky:
        mode |= stat.S_ISVTX
    if isuid:
        mode |= stat.ST_UID
    if isgid:
        mode |= stat.ST_GID
    mode |= type
    return mode
helper function to calculate the mode bits of a file.
lib/stashutils/fsi/base.py