Display I/O statistics for the given pools

    zpool : string
        optional name of storage pool

    sample_time : int
        seconds to capture data before output
        default a sample of 5 seconds is used
    parsable : boolean
        display data in pythonc values (True, False, Bytes,...)

    .. versionadded:: 2016.3.0
    .. versionchanged:: 2018.3.1

        Added ```parsable``` parameter that defaults to True

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.iostat myzpool

def iostat(zpool=None, sample_time=5, parsable=True):
    '''
    Display I/O statistics for the given pools

    zpool : string
        optional name of storage pool

    sample_time : int
        seconds to capture data before output
        default a sample of 5 seconds is used
    parsable : boolean
        display data in pythonc values (True, False, Bytes,...)

    .. versionadded:: 2016.3.0
    .. versionchanged:: 2018.3.1

        Added ```parsable``` parameter that defaults to True

    CLI Example:

    .. code-block:: bash

        salt '*' zpool.iostat myzpool

    '''
    ret = OrderedDict()

    ## get iostat output
    res = __salt__['cmd.run_all'](
        __utils__['zfs.zpool_command'](
            command='iostat',
            flags=['-v'],
            target=[zpool, sample_time, 2]
        ),
        python_shell=False,
    )

    if res['retcode'] != 0:
        return __utils__['zfs.parse_command_result'](res)

    # NOTE: command output for reference
    # =====================================================================
    #                               capacity     operations    bandwidth
    # pool                       alloc   free   read  write   read  write
    # -------------------------  -----  -----  -----  -----  -----  -----
    # mypool                      648G  1.18T     10      6  1.30M   817K
    #   mirror                    648G  1.18T     10      6  1.30M   817K
    #     c0tXXXXCXXXXXXXXXXXd0      -      -      9      5  1.29M   817K
    #     c0tXXXXCXXXXXXXXXXXd0      -      -      9      5  1.29M   817K
    #     c0tXXXXCXXXXXXXXXXXd0      -      -      9      5  1.29M   817K
    # -------------------------  -----  -----  -----  -----  -----  -----
    # =====================================================================

    ## parse iostat output
    # NOTE: hardcode the header
    #       the double header line is hard to parse, we opt to
    #       hardcode the header fields
    header = [
        'name',
        'capacity-alloc', 'capacity-free',
        'operations-read', 'operations-write',
        'bandwith-read', 'bandwith-write',
    ]
    root_vdev = None
    vdev = None
    dev = None
    current_data = OrderedDict()
    for line in res['stdout'].splitlines():
        # NOTE: skip header
        if line.strip() == '' or \
           line.strip().split()[-1] in ['write', 'bandwidth']:
            continue

        # NOTE: reset pool on line separator
        if line.startswith('-') and line.endswith('-'):
            ret.update(current_data)
            current_data = OrderedDict()
            continue

        # NOTE: transform data into dict
        io_data = OrderedDict(list(zip(
            header,
            [x for x in line.strip().split(' ') if x not in ['']],
        )))

        # NOTE: normalize values
        if parsable:
            # NOTE: raw numbers and pythonic types
            io_data = __utils__['zfs.from_auto_dict'](io_data)
        else:
            # NOTE: human readable zfs types
            io_data = __utils__['zfs.to_auto_dict'](io_data)

        # NOTE: store io_data in the proper location
        if line.startswith(' ' * 4):
            dev = io_data['name']
            current_data[root_vdev][vdev][dev] = io_data
        elif line.startswith(' ' * 2):
            dev = None
            vdev = io_data['name']
            current_data[root_vdev][vdev] = io_data
        else:
            dev = vdev = None
            root_vdev = io_data['name']
            current_data[root_vdev] = io_data

        # NOTE: name already used as identifier, drop duplicate data
        del io_data['name']

    return ret