def to_dict(_str, pair_sep=',', kv_sep='='):
    """
    Convert string to dict
    :param _str: str
        Example:
            a=5,b=6,c=abc
    :param pair_sep: separator for each pair
    :param kv_sep: separator for key and value
    :return: dict
    """
    if not isinstance(_str, str):
        raise TypeError
    return {item[0].strip(): item[1].strip() for item in
            [_item.strip().split(kv_sep, 1) for _item in _str.split(pair_sep) if kv_sep in _item]}