# 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 total == 0:
        return 0  # even if free is not 0, it is better to alert authorities
    value = None
    if mode == 'free':
        value = free
    elif mode == 'total':
        value = total
    elif mode == 'used':
        value = total - free
    elif mode == 'pfree':
        value = (free / total) * 100
    elif mode == 'pused':
        used = (total - free)
        value = (used / total) * 100
    return value


def lines_from_file(file_path, n=None):
    """
    Returns list of lines read from file

    :param n: Number of lines to read from file
    :raises: OperatingSystemError if file is empty
    :raises: IOError if unable to read lines from file
    """
    with open(file_path, "r") as f:
        lines = list(islice((line.rstrip() for line in f), n))

    if len(lines) == 0:

# 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 total == 0:
        return 0  # even if free is not 0, it is better to alert authorities
    value = None
    if mode == 'free':
        value = free
    elif mode == 'total':
        value = total
    elif mode == 'used':
        value = total - free
    elif mode == 'pfree':
        value = (free / total) * 100
    elif mode == 'pused':
        used = (total - free)
        value = (used / total) * 100
    return value


def lines_from_file(file_path, n=None):
    """
    Returns list of lines read from file

    :param n: Number of lines to read from file
    :raises: OperatingSystemError if file is empty
    :raises: IOError if unable to read lines from file
    """
    with open(file_path, "r") as f:
        lines = list(islice((line.rstrip() for line in f), n))

    if len(lines) == 0:

        raise OperatingSystemError("{file} is empty".format(file=file_path))