def process_selection(selected):
    """
    Processes selection. Either returnes a list in case of single or mutiple 
    specific selection, or a range if a range is specified. Returns None, in 
    the case of a single ':' as input.
    Raises ValueError for wrong string format and TypeError if non-ints are given, 
    or something unexpected.
    """
    if isinstance(selected, int):
        #returns 1 long list for singe selection
        return [selected]
    elif isinstance(selected, str):
        #returns range if a string is specified. string is broken up by ":"
        if selected == ':':
            return None
        selected = selected.split(':')
        try:
            first = int(selected[0])
            last = int(selected[1])
        except (ValueError, IndexError):
            raise ValueError('Input string should be of format from:to(:by).')
        if len(selected) == 3:
            #step bw elements is optional
            step = int(selected[2])
            return range(first, last, step)
        elif len(selected) > 3:
            raise ValueError('Input string should be of format from:to(:by).')
        else:
            return range(first, last)
    elif hasattr(selected, '__iter__'):
        #if selection is iterable, put all elements into a list
        a = []
        for x in selected:
            if isinstance(x, int):
                a.append(x)
            else:
                raise TypeError('Field line selection should only have integers.')
        return a
    else:
        raise TypeError('Wrong field line selection format.')