def orient_index(orientation, angles):
    """Get the index to be used for a given face/aperture orientation from an angle list.

    Args:
        orientation: The horizontal cardinal orientation of the Face or Aperture
            in degrees.
        angles: A list of angles that denote the boundaries of each orientation
            category.

    Returns:
        An integer for the index used to assign properties to the object of the
        input orientation.
    """
    for i, ang in enumerate(angles):
        if orientation < ang:
            return i
    return 0
