def quote_as2name(unquoted_name):
    """
    Function converts as2 name from unquoted to quoted format
    :param unquoted_name: the as2 name in unquoted format
    :return: the as2 name in unquoted format
    """

    if re.search(r'[\\" ]', unquoted_name, re.M):
        return '"' + email.utils.quote(unquoted_name) + '"'
    else:
        return unquoted_name
def quote_as2name ( unquoted_name ) : if re . search ( r'[\\" ]' , unquoted_name , re . M ) : return '"' + email . utils . quote ( unquoted_name ) + '"' else : return unquoted_name
Function converts as2 name from unquoted to quoted format
    :param unquoted_name: the as2 name in unquoted format
    :return: the as2 name in unquoted format