(dict_kwargs)
return result_dict
Take in a dictionary of keyword arguments where values are converted to the specified data type.
    The values in the dictionary should be a string of the form: "value|type"
    e.g. {"arg1": "2|int", "arg2": "2.0|float", "arg3": "True|bool", "arg4": "string|str"}
    Dictionaries, lists and arrays are allowed with the following format:
    "x:1;y:2|dict|str|int" where str is the type for keys and int is the type for values
    "x;y;z|array|str" where str is the type of values in the array
    "1;2;3|list|int" where int is the type of the values in the list
    "0;1|tuple|int" where int is the type of the values in the tuple
Take in a dictionary of keyword arguments where values are converted to the specified data type.
    The values in the dictionary should be a string of the form: "value|type"
    e.g. {"arg1": "2|int", "arg2": "2.0|float", "arg3": "True|bool", "arg4": "string|str"}
    Dictionaries, lists and arrays are allowed with the following format:
    "x:1;y:2|dict|str|int" where str is the type for keys and int is the type for values
    "x;y;z|array|str" where str is the type of values in the array
    "1;2;3|list|int" where int is the type of the values in the list
    "0;1|tuple|int" where int is the type of the values in the tuple
Take in a dictionary of keyword arguments where values are converted to the specified data type . The values in the dictionary should be a string of the form : value|type e . g . { arg1 : 2|int arg2 : 2 . 0|float arg3 : True|bool arg4 : string|str } Dictionaries lists and arrays are allowed with the following format : x : 1 ; y : 2|dict|str|int where str is the type for keys and int is the type for values x ; y ; z|array|str where str is the type of values in the array 1 ; 2 ; 3|list|int where int is the type of the values in the list 0 ; 1|tuple|int where int is the type of the values in the tuple
def get_kwargs_by_type(dict_kwargs):
    """
    Take in a dictionary of keyword arguments where values are converted to the specified data type.
    The values in the dictionary should be a string of the form: "value|type"
    e.g. {"arg1": "2|int", "arg2": "2.0|float", "arg3": "True|bool", "arg4": "string|str"}
    Dictionaries, lists and arrays are allowed with the following format:
    "x:1;y:2|dict|str|int" where str is the type for keys and int is the type for values
    "x;y;z|array|str" where str is the type of values in the array
    "1;2;3|list|int" where int is the type of the values in the list
    "0;1|tuple|int" where int is the type of the values in the tuple
    """
    
    # Dictionary used to convert argument values to the correct type
    types = {"boolean":ast.literal_eval, "bool":ast.literal_eval, "integer":atoi, "int":atoi,\
             "float":atof, "string":str, "str":str, "none":atonone, "None":atonone}
    
    result_dict = {}
    
    # Fill up the dictionary with the keyword arguments
    for k, v in dict_kwargs.items():
        # Split the value and type
        split = v.split("|")

        try:
            if len(split) == 2:      
                # Handle conversion from string to boolean
                if split[1] in ("boolean", "bool"):
                    split[0] = split[0].capitalize()
                
                # Convert the value based on the correct type
                result_dict[k] = types[split[1]](split[0])
            
            elif split[1] == "dict":
                # If the argument is a dictionary convert keys and values according to the correct types
                items = split[0].split(";")
                d = {}
                
                for i in items:
                    a,b = i.split(":")
                    
                    # Handle conversion from string to boolean
                    if split[2] in ("boolean", "bool"):
                        a = a.capitalize()
                    if split[3] in ("boolean", "bool"):
                        b = b.capitalize()
                    
                    # Handle None as an item in the dictionary
                    if b in ("None", "none"):
                        d[types[split[2]](a)] = None
                    else:
                        d[types[split[2]](a)] = types[split[3]](b)
                
                result_dict[k] = d
            
            elif split[1] in ("list", "array", "tuple"):
                # If the argument is a list, array or tuple convert keys and values according to the correct types
                items = split[0].split(";")
                l = []
                
                for i in items:
                    # Handle conversion from string to boolean
                    if split[2] in ("boolean", "bool"):
                        i = i.capitalize()

                    # Handle None as an item
                    if i in ("None", "none"):
                        l.append(None)
                    else:
                        l.append(types[split[2]](i))
                
                if split[1] == "array":
                    l = np.array(l)
                elif split[1] == "tuple":
                    l = tuple(l)
                    
                result_dict[k] = l
        except IndexError:
            err = "List index out of range. This is most likely due to incorrect syntax of keyword arguments."
            raise Exception(err)
    
    return result_dict
def get_kwargs_by_type ( dict_kwargs ) : # Dictionary used to convert argument values to the correct type types = { "boolean" : ast . literal_eval , "bool" : ast . literal_eval , "integer" : atoi , "int" : atoi , "float" : atof , "string" : str , "str" : str , "none" : atonone , "None" : atonone } result_dict = { } # Fill up the dictionary with the keyword arguments for k , v in dict_kwargs . items ( ) : # Split the value and type split = v . split ( "|" ) try : if len ( split ) == 2 : # Handle conversion from string to boolean if split [ 1 ] in ( "boolean" , "bool" ) : split [ 0 ] = split [ 0 ] . capitalize ( ) # Convert the value based on the correct type result_dict [ k ] = types [ split [ 1 ] ] ( split [ 0 ] ) elif split [ 1 ] == "dict" : # If the argument is a dictionary convert keys and values according to the correct types items = split [ 0 ] . split ( ";" ) d = { } for i in items : a , b = i . split ( ":" ) # Handle conversion from string to boolean if split [ 2 ] in ( "boolean" , "bool" ) : a = a . capitalize ( ) if split [ 3 ] in ( "boolean" , "bool" ) : b = b . capitalize ( ) # Handle None as an item in the dictionary if b in ( "None" , "none" ) : d [ types [ split [ 2 ] ] ( a ) ] = None else : d [ types [ split [ 2 ] ] ( a ) ] = types [ split [ 3 ] ] ( b ) result_dict [ k ] = d elif split [ 1 ] in ( "list" , "array" , "tuple" ) : # If the argument is a list, array or tuple convert keys and values according to the correct types items = split [ 0 ] . split ( ";" ) l = [ ] for i in items : # Handle conversion from string to boolean if split [ 2 ] in ( "boolean" , "bool" ) : i = i . capitalize ( ) # Handle None as an item if i in ( "None" , "none" ) : l . append ( None ) else : l . append ( types [ split [ 2 ] ] ( i ) ) if split [ 1 ] == "array" : l = np . array ( l ) elif split [ 1 ] == "tuple" : l = tuple ( l ) result_dict [ k ] = l except IndexError : err = "List index out of range. This is most likely due to incorrect syntax of keyword arguments." raise Exception ( err ) return result_dict