'Updates container sync headers
:param name: The name of the object
:param sync_to: The URL to the remote container.
:param user_key: The X-Container-Sync-Key to use when sending requests
to the other container.
:param realm: The realm from self.realms_conf, if there is one.
If None, fallback to using the older allowed_sync_hosts
way of syncing.
:param realm_key: The realm key from self.realms_conf, if there
is one. If None, fallback to using the older
allowed_sync_hosts way of syncing.
:param method: HTTP method to create sig with
:param headers: headers to update with container sync headers'

def _update_sync_to_headers(self, name, sync_to, user_key, realm, realm_key, method, headers):

    if (realm and realm_key):
        nonce = uuid.uuid4().hex
        path = ((urlparse(sync_to).path + '/') + quote(name))
        sig = self.realms_conf.get_sig(method, path, headers.get('x-timestamp', 0), nonce, realm_key, user_key)
        headers['x-container-sync-auth'] = ('%s    %s    %s' % (realm, nonce, sig))
    else:
        headers['x-container-sync-key'] = user_key
