def str_to_dict(text):
    """
    This function converts a string to a dictionary

    :type   text: string
    :param  text: string to be converted
    String to be converted should be as follow :
        string_to_convert="key1:value1,key2:value2..."
        result={'key1':'value1', 'key2':'value2'}

    :rtype: dict
    :return: string converted to a dictionary
    """
    string_to_dict = {}
    splitted_text = [str(x).split(":") for x in str(text).split(",")]
    for dict_element in splitted_text:
        if dict_element[0]:
            string_to_dict.update({dict_element[0]: dict_element[1]})
    return string_to_dict