# Path: reggata/helpers.py
# def is_none_or_empty(s):
#     '''
#         Returns True, if given string s is None or "" (empty string).
#     If s is and instance of class different from str, function raises TypeError.
#     '''
#     if s is None:
#         return True
#     else:
#         if not isinstance(s, str):
#             raise TypeError("is_none_or_empty() can be applied only to str objects.")
#         return True if s == "" else False


import re
from reggata.helpers import is_none_or_empty


def escape(string):
    # Escaping slashes first
    string = re.sub(r'\\', r'\\\\', string)

    # And only then, escaping all the other symbols
    string = re.sub(r'"', r'\"', string)
    return string


def unescape(string):
    string = re.sub(r'\\"', r'"', string)
    string = re.sub(r'\\\\', r'\\', string)
    return string


def quote(string):
    '''
        Escapes all symbols of the given string and puts the string
    in a quotes. Returns modified string.
    '''
    return '"' + escape(string) + '"'


def unquote(string):
    '''
        Removes quotes and unescapes all symbols of the string.
    Returns modified string.
    '''

# Path: reggata/helpers.py
# def is_none_or_empty(s):
#     '''
#         Returns True, if given string s is None or "" (empty string).
#     If s is and instance of class different from str, function raises TypeError.
#     '''
#     if s is None:
#         return True
#     else:
#         if not isinstance(s, str):
#             raise TypeError("is_none_or_empty() can be applied only to str objects.")
#         return True if s == "" else False


# Path: reggata/parsers/util.py
import re
from reggata.helpers import is_none_or_empty



def escape(string):
    # Escaping slashes first
    string = re.sub(r'\\', r'\\\\', string)

    # And only then, escaping all the other symbols
    string = re.sub(r'"', r'\"', string)
    return string


def unescape(string):
    string = re.sub(r'\\"', r'"', string)
    string = re.sub(r'\\\\', r'\\', string)
    return string


def quote(string):
    '''
        Escapes all symbols of the given string and puts the string
    in a quotes. Returns modified string.
    '''
    return '"' + escape(string) + '"'


def unquote(string):
    '''
        Removes quotes and unescapes all symbols of the string.
    Returns modified string.
    '''

    if not is_none_or_empty(string) and string.startswith('"') \