<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _mkpart(root, fs_format, fs_opts, mount_dir):
    '''
    Make a partition, and make it bootable

    .. versionadded:: Beryllium
    '''
    __salt__['partition.mklabel'](root, 'msdos')
    loop1 = __salt__['cmd.run']('losetup -f')
    log.debug('First loop device is %s', loop1)
    __salt__['cmd.run']('losetup {0} {1}'.format(loop1, root))
    part_info = __salt__['partition.list'](loop1)
    start = six.text_type(2048 * 2048) + 'B'
    end = part_info['info']['size']
    __salt__['partition.mkpart'](loop1, 'primary', start=start, end=end)
    __salt__['partition.set'](loop1, '1', 'boot', 'on')
    part_info = __salt__['partition.list'](loop1)
    loop2 = __salt__['cmd.run']('losetup -f')
    log.debug('Second loop device is %s', loop2)
    start = start.rstrip('B')
    __salt__['cmd.run']('losetup -o {0} {1} {2}'.format(start, loop2, loop1))
    _mkfs(loop2, fs_format, fs_opts)
    __salt__['mount.mount'](mount_dir, loop2)
    __salt__['cmd.run']((
        'grub-install',
        '--target=i386-pc',
        '--debug',
        '--no-floppy',
        '--modules=part_msdos linux',
        '--boot-directory={0}/boot'.format(mount_dir),
        loop1
    ), python_shell=False)
    __salt__['mount.umount'](mount_dir)
    __salt__['cmd.run']('losetup -d {0}'.format(loop2))
    __salt__['cmd.run']('losetup -d {0}'.format(loop1))
    return part_info