Removes a distributed virtual portgroup.

    portgroup
        Name of the portgroup to be removed.

    dvs
        Name of the DVS containing the portgroups.

    service_instance
        Service instance (vim.ServiceInstance) of the vCenter.
        Default is None.

    .. code-block:: bash

        salt '*' vsphere.remove_dvportgroup portgroup=pg1 dvs=dvs1

def remove_dvportgroup(portgroup, dvs, service_instance=None):
    '''
    Removes a distributed virtual portgroup.

    portgroup
        Name of the portgroup to be removed.

    dvs
        Name of the DVS containing the portgroups.

    service_instance
        Service instance (vim.ServiceInstance) of the vCenter.
        Default is None.

    .. code-block:: bash

        salt '*' vsphere.remove_dvportgroup portgroup=pg1 dvs=dvs1
    '''
    log.trace('Removing portgroup\'%s\' in dvs \'%s\'', portgroup, dvs)
    proxy_type = get_proxy_type()
    if proxy_type == 'esxdatacenter':
        datacenter = __salt__['esxdatacenter.get_details']()['datacenter']
        dc_ref = _get_proxy_target(service_instance)
    elif proxy_type == 'esxcluster':
        datacenter = __salt__['esxcluster.get_details']()['datacenter']
        dc_ref = salt.utils.vmware.get_datacenter(service_instance, datacenter)
    dvs_refs = salt.utils.vmware.get_dvss(dc_ref, dvs_names=[dvs])
    if not dvs_refs:
        raise VMwareObjectRetrievalError('DVS \'{0}\' was not '
                                         'retrieved'.format(dvs))
    pg_refs = salt.utils.vmware.get_dvportgroups(dvs_refs[0],
                                                 portgroup_names=[portgroup])
    if not pg_refs:
        raise VMwareObjectRetrievalError('Portgroup \'{0}\' was not '
                                         'retrieved'.format(portgroup))
    salt.utils.vmware.remove_dvportgroup(pg_refs[0])
    return True