def extract_lungs(separated):
    """
    Extract lungs.

    Args:
        separated: A mask of lungs.

    Returns:
        The masks of segmented and separated lungs.
    """
    left_lung = separated.copy()
    left_lung[left_lung != 1] = 0
    right_lung = separated.copy()
    right_lung[right_lung != 2] = 0
    right_lung[right_lung == 2] = 1
    return left_lung, right_lung