Make a <part_type> partition with a new filesystem of <fs_type>, beginning
    at <start> and ending at <end> (by default in megabytes).

    <part_type> should be one of "primary", "logical", or "extended". <fs_type>
    must be one of "ext2", "fat32", "fat16", "linux-swap" or "reiserfs" (if
    libreiserfs is installed)

    CLI Example:

    .. code-block:: bash

        salt '*' partition.mkpartfs /dev/sda logical ext2 440 670

def mkpartfs(device, part_type, fs_type, start, end):
    '''
    Make a <part_type> partition with a new filesystem of <fs_type>, beginning
    at <start> and ending at <end> (by default in megabytes).

    <part_type> should be one of "primary", "logical", or "extended". <fs_type>
    must be one of "ext2", "fat32", "fat16", "linux-swap" or "reiserfs" (if
    libreiserfs is installed)

    CLI Example:

    .. code-block:: bash

        salt '*' partition.mkpartfs /dev/sda logical ext2 440 670
    '''
    _validate_device(device)

    if part_type not in set(['primary', 'logical', 'extended']):
        raise CommandExecutionError(
            'Invalid part_type passed to partition.mkpartfs'
        )

    if not _is_fstype(fs_type):
        raise CommandExecutionError(
            'Invalid fs_type passed to partition.mkpartfs'
        )

    _validate_partition_boundary(start)
    _validate_partition_boundary(end)

    cmd = 'parted -m -s -- {0} mkpart {1} {2} {3} {4}'.format(
        device, part_type, fs_type, start, end
    )
    out = __salt__['cmd.run'](cmd).splitlines()
    return out