# Path: zabby/core/exceptions.py
# class WrongArgumentError(Exception):
#     """ Wrong argument was passed to a function"""
# 
# class OperatingSystemError(Exception):
#     """ Operating system behaved in an unusual manner """
# 
# Path: zabby/core/six.py
# PY3 = sys.version_info[0] == 3
#     def b(s):
#     def u(s):
#     def b(s):
#     def u(s):


import socket
import logging
import time
from subprocess import Popen, PIPE
from itertools import islice
from zabby.core.exceptions import WrongArgumentError, OperatingSystemError
from zabby.core.six import binary_type

        if err != '':
            message = "'{0}' has written to stderr: {1}".format(
                formatted_command, err)

            if raise_on_nonempty_err:
                raise OperatingSystemError(message)
            else:
                log = logging.getLogger('sh')
                log.warn(message)

        return out

    return call_command


def tcp_communication(port, host='localhost', requests=list(),
                      receive_first=False, timeout=1.0):
    """
    Connects to port, optionally sending requests and returns any responses

    :param requests: list of binary objects that will be sent in order
        it is expected that there will be a response for every request
    :param receive_first: if true will try to receive data before sending any
        requests

    :raises: IOError, no exception handling is done in this function, most
        exceptions will be socket exceptions
    """
    if any([not isinstance(request, binary_type) for request in requests]):

# Path: zabby/core/exceptions.py
# class WrongArgumentError(Exception):
#     """ Wrong argument was passed to a function"""
# 
# class OperatingSystemError(Exception):
#     """ Operating system behaved in an unusual manner """
# 
# Path: zabby/core/six.py
# PY3 = sys.version_info[0] == 3
#     def b(s):
#     def u(s):
#     def b(s):
#     def u(s):


# Path: zabby/core/utils.py
import socket
import logging
import time
from subprocess import Popen, PIPE
from itertools import islice
from zabby.core.exceptions import WrongArgumentError, OperatingSystemError
from zabby.core.six import binary_type


        if err != '':
            message = "'{0}' has written to stderr: {1}".format(
                formatted_command, err)

            if raise_on_nonempty_err:
                raise OperatingSystemError(message)
            else:
                log = logging.getLogger('sh')
                log.warn(message)

        return out

    return call_command


def tcp_communication(port, host='localhost', requests=list(),
                      receive_first=False, timeout=1.0):
    """
    Connects to port, optionally sending requests and returns any responses

    :param requests: list of binary objects that will be sent in order
        it is expected that there will be a response for every request
    :param receive_first: if true will try to receive data before sending any
        requests

    :raises: IOError, no exception handling is done in this function, most
        exceptions will be socket exceptions
    """
    if any([not isinstance(request, binary_type) for request in requests]):

        raise WrongArgumentError("Every request should be in binary. "