'Add `dist` to working set, associated with `entry`
If `entry` is unspecified, it defaults to the ``.location`` of `dist`.
On exit from this routine, `entry` is added to the end of the working
set\'s ``.entries`` (if it wasn\'t already present).
`dist` is only added to the working set if it\'s for a project that
doesn\'t already have a distribution in the set.  If it\'s added, any
callbacks registered with the ``subscribe()`` method will be called.'

def add(self, dist, entry=None, insert=True):

    if insert:
        dist.insert_on(self.entries, entry)
    if (entry is None):
        entry = dist.location
    keys = self.entry_keys.setdefault(entry, [])
    keys2 = self.entry_keys.setdefault(dist.location, [])
    if (dist.key in self.by_key):
        return
    self.by_key[dist.key] = dist
    if (dist.key not in keys):
        keys.append(dist.key)
    if (dist.key not in keys2):
        keys2.append(dist.key)
    self._added_new(dist)
