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

def create_binding(self, key, shard=None, public=False,
                       special_lobby_binding=False):
        '''Used by Interest instances.'''
        shard = shard or self.get_shard_id()
        factory = recipient.Broadcast if public else recipient.Agent
        recp = factory(key, shard)
        binding = self._messaging.create_binding(recp)
        if special_lobby_binding:
            # this is WeakKeyDictionary
            self._bindings_preserved_on_shard_change[binding] = True
        return binding