def string_to_array(string, conversion=None):
    """ Convert a string separated by spaces to an array, i.e.
    a b c -> [a,b,c]

    Parameters
    ----------
    string : str
        String to convert to an array
    conversion : function, optional
        Function to use to convert the string to an array

    Returns
    -------
    array : list
        List of items
     """

    if isinstance(string, list):
        return string

    # Default: convert to list of ints
    if not conversion:
        conversion = int

    parts = string.split(" ")
    array = [conversion(i) for i in parts]
    return array