<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def shell_quote(s):
    'Quotes a string if it is not already quoted'
    return s if isinstance(s, ShellQuoted) \
        else ShellQuoted("'" + str(s).replace("'", "'\\''") + "'")