def strip_spaces_list(list_in, strip_method="all"):
    """
    Remove spaces from all items in a list
    :param list_in:
    :param strip_method: Default: 'all' for leading and trailing spaces.
    Can also be 'leading' or 'trailing'
    :return: List with items stripped of spaces
    """

    if strip_method == "all":
        list_out = [item.strip() for item in list_in]
    elif strip_method == "leading":
        list_out = [item.rstrip() for item in list_in]
    elif strip_method == "trailing":
        list_out = [item.lstrip() for item in list_in]
    else:
        raise NotImplementedError(
            'Strip method: "{}" is not implemented. Please use "all", '
            '"leading" or "trailing"'.format(strip_method)
        )
    return list_out