def elem_quote(member):
    """Simple method to add the most appropriate quote to an element.
    Element is first converted to a string.
    If the element contains both \' and \" then \" is escaped as '&mjf-quot;'
    If the element contains \n it is escaped as '&mjf-lf;'
    Both are restored transparently by unquote.

    If you only have literal strings at this stage and will be parsing with escaping on -
    you might want to do a replace('\\', '\\\\') on the member too...
    """
#        member = str(member)                                            # since we now stringify everything - this is probably a redundant command
    if member.find("'") == -1:
        outline = "'" + member + "'"
    elif member.find('"') == -1:
        outline = '"' + member + '"'
    else:
        outline = '"' + member.replace('"','&mjf-quot;')+'"'
    return outline.replace('\n','&mjf-lf;')
Simple method to add the most appropriate quote to an element.
    Element is first converted to a string.
    If the element contains both ' and " then " is escaped as '&mjf-quot;'
    If the element contains 
 it is escaped as '&mjf-lf;'
    Both are restored transparently by unquote.

    If you only have literal strings at this stage and will be parsing with escaping on -
    you might want to do a replace('\', '\\') on the member too...
    
recipes/Python/281056_Listparse/recipe-281056.py