def get_zip_perms(zipinfo):
    """Get file/dir permissions from zipinfo
    Args:
        zipinfo (zipfile.Zipinfo): information about one component file of a
            zip-file

    Returns:
        int: file permissions for file in octal
    """
    # Windows zip files with no permissions seem to sensibly default to 0o0000
    perm_octal = (zipinfo.external_attr >> 16) & 0o0777
    return perm_octal