def get_local_group_information(task, portgroup):
    """Extract the portgroup information.

    The information is returned in the form of::

        {
            'id': portgroup.uuid,
            'name': portgroup.name,
            'bond_mode': portgroup.mode,
            'bond_properties': {
                'bond_propertyA': 'valueA',
                'bond_propertyB': 'valueB',
            }
        }

    :param task: a task containing the Node object.
    :param portgroup: Ironic portgroup object to extract data for.
    :returns: port group information as a dict
    """
    portgroup_properties = {}
    for prop, value in portgroup.properties.items():
        key = prop if prop.startswith('bond') else 'bond_%s' % prop
        portgroup_properties[key] = value
    return {'id': portgroup.uuid, 'name': portgroup.name, 'bond_mode':
        portgroup.mode, 'bond_properties': portgroup_properties}
