<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def copy(string, xsel=False):
 """Copy given string into system clipboard. If 'xsel' is True, this will also copy into the primary x selection for middle click."""

    try:
        _cmd = ["xclip", "-selection", "clipboard"]
        subprocess.Popen(_cmd, stdin=subprocess.PIPE).communicate(
                string.encode('utf-8'))
        if xsel:
            _cmd = ["xclip", "-selection", "primary"]
            subprocess.Popen(_cmd, stdin=subprocess.PIPE).communicate(
                    string.encode('utf-8'))
    except OSError as why:
        raise XclipNotFound