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

def _bootstrap_pacman(
        root,
        pkg_confs='/etc/pacman*',
        img_format='dir',
        pkgs=None,
        exclude_pkgs=None,
    ):
    '''
    Bootstrap an image using the pacman tools

    root
        The root of the image to install to. Will be created as a directory if
        it does not exist. (e.x.: /root/arch)

    pkg_confs
        The location of the conf files to copy into the image, to point pacman
        to the right repos and configuration.

    img_format
        The image format to be used. The ``dir`` type needs no special
        treatment, but others need special treatment.

    pkgs
        A list of packages to be installed on this image. For Arch Linux, this
        will include ``pacman``, ``linux``, ``grub``, and ``systemd-sysvcompat``
        by default.

    exclude_pkgs
        A list of packages to be excluded. If you do not want to install the
        defaults, you need to include them in this list.
    '''
    _make_nodes(root)

    if pkgs is None:
        pkgs = []
    elif isinstance(pkgs, six.string_types):
        pkgs = pkgs.split(',')

    default_pkgs = ('pacman', 'linux', 'systemd-sysvcompat', 'grub')
    for pkg in default_pkgs:
        if pkg not in pkgs:
            pkgs.append(pkg)

    if exclude_pkgs is None:
        exclude_pkgs = []
    elif isinstance(exclude_pkgs, six.string_types):
        exclude_pkgs = exclude_pkgs.split(',')

    for pkg in exclude_pkgs:
        pkgs.remove(pkg)

    if img_format != 'dir':
        __salt__['mount.mount']('{0}/proc'.format(root), '/proc', fstype='', opts='bind')
        __salt__['mount.mount']('{0}/dev'.format(root), '/dev', fstype='', opts='bind')

    __salt__['file.mkdir'](
        '{0}/var/lib/pacman/local'.format(root), 'root', 'root', '755'
    )
    pac_files = [rf for rf in os.listdir('/etc') if rf.startswith('pacman.')]
    for pac_file in pac_files:
        __salt__['cmd.run']('cp -r /etc/{0} {1}/etc'.format(pac_file, _cmd_quote(root)))
    __salt__['file.copy']('/var/lib/pacman/sync', '{0}/var/lib/pacman/sync'.format(root), recurse=True)

    pacman_args = ['pacman', '--noconfirm', '-r', _cmd_quote(root), '-S'] + pkgs
    __salt__['cmd.run'](pacman_args, python_shell=False)

    if img_format != 'dir':
        __salt__['mount.umount']('{0}/proc'.format(root))
        __salt__['mount.umount']('{0}/dev'.format(root))