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

def remove(name=None, pkgs=None, purge=False, **kwargs):  # pylint: disable=unused-argument
    '''
    Remove packages using ``apk del``.

    name
        The name of the package to be deleted.


    Multiple Package Options:

    pkgs
        A list of packages to delete. Must be passed as a python list. The
        ``name`` parameter will be ignored if this option is passed.

    Returns a dict containing the changes.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.remove <package name>
        salt '*' pkg.remove <package1>,<package2>,<package3>
        salt '*' pkg.remove pkgs='["foo", "bar"]'
    '''
    old = list_pkgs()
    pkg_to_remove = []

    if name:
        if ',' in name:
            pkg_to_remove = name.split(',')
        else:
            pkg_to_remove = [name]

    if pkgs:
        pkg_to_remove.extend(pkgs)

    if not pkg_to_remove:
        return {}

    if purge:
        cmd = ['apk', 'del', '--purge']
    else:
        cmd = ['apk', 'del']

    cmd.extend(pkg_to_remove)

    out = __salt__['cmd.run_all'](
        cmd,
        output_loglevel='trace',
        python_shell=False
    )
    if out['retcode'] != 0 and out['stderr']:
        errors = [out['stderr']]
    else:
        errors = []

    __context__.pop('pkg.list_pkgs', None)
    new = list_pkgs()
    ret = salt.utils.data.compare_dicts(old, new)

    if errors:
        raise CommandExecutionError(
            'Problem encountered removing package(s)',
            info={'errors': errors, 'changes': ret}
        )

    return ret