# coding=utf-8

import subprocess


def pasteboard_read():
    return subprocess.check_output('pbpaste', env={'LANG': 'en_US.UTF-8'}) \
        .decode('utf-8')


def pasteboard_write(output):
    process = subprocess.Popen(
        'pbcopy',
        env={'LANG': 'en_US.UTF-8'},
        stdin=subprocess.PIPE
    )
    process.communicate(output.encode('utf-8'))
