# -*- coding: utf-8 -*-
import os
import platform
import subprocess

class PlatformNotSuppored(Exception):
    pass

is_linux = lambda : os.name == 'posix' or platform.system() == 'Linux'

def _subprocess_copy(text, args_list):
    p = subprocess.Popen(args_list, stdin=subprocess.PIPE, close_fds=True)
    p.communicate(input=text.encode('utf-8'))

def _subprocess_paste(text, args_list):
    p = subprocess.Popen(args_list, stdout=subprocess.PIPE, close_fds=True)
    out, err = p.communicate()
    return out.decode('utf-8')

def get_command_name():
    """
    Checks for the installation of xsel or xclip
    """

    for cmd in ['xsel', 'xclip']:
        cmd_exists = subprocess.call(
            ['which', cmd],
            stdout=subprocess.PIPE, stderr=subprocess.PIPE) is 0
        if cmd_exists:
            return cmd
        return None

def copy(text):
    """
    Copy text to OS clipboard.
    """

    if not is_linux():
        raise PlatformNotSuppored('Operative System not supported')
    cmd_args = {'xsel' : ['xsel', '-b', '-i'],
                'xclip' : ['xclip', '-selection', 'c']}
    cmd_name = get_command_name()
    if cmd_name is None:
        raise Exception("xsel or xclip is not installed")
    _subprocess_copy(text, cmd_args.get(cmd_name))

def paste():
    """
    Paste text from OS clipboard.
    """

    if not is_linux():
        raise PlatformNotSuppored('Operative System not supported')
    cmd_args = {'xsel' : ['xsel', '-b', '-o'],
                'xclip': ['xclip', '-selection', '-o']}
    cmd_name = get_command_name()
    if cmd_name is None:
        raise Exception("xsel or xclip is not installed")
    return _subprocess_paste(text, cmd_args.get(cmd_name))

@@ -66,56 +66,8 @@
 ss%0A%0A
-class PlatformNotSuppored(Exception):%0A    pass%0A%0A
 is_l
@@ -897,35 +897,23 @@
   raise 
-PlatformNotSuppored
+OSError
 ('Operat
@@ -1316,27 +1316,15 @@
 ise 
-PlatformNotSuppored
+OSError
 ('Op

Replace custom exception by OSError