def check_orientation(orientation):
    """
    Check the orientation argument (used by other package functions).

    Parameters
    ----------
    orientation : 'portrait' or 'landscape'
        the desired orientation of the output image

    Returns
    -------
    str

    Raises
    ------
    ValueError : invalid orientation argument provided

    """
    if orientation not in ['landscape', 'portrait', 'l', 'p']:
        raise ValueError('orientation must be landscape or portrait')
    if orientation == 'l':
        return 'landscape'
    elif orientation == 'p':
        return 'portrait'
    return orientation
