def METHOD_NAME(self, enc_alg, headers, key, sender_key, preset=None):
    # In this class this method is used in direct key agreement mode only
    if self.key_size is not None:
        raise RuntimeError('Invalid algorithm state detected')
    if preset and 'epk' in preset:
        epk = preset['epk']
        h = {}
    else:
        epk = self._generate_ephemeral_key(key)
        h = self._prepare_headers(epk)
    dk = self._agree_upon_key_at_sender(enc_alg, headers, key, sender_key, epk)
    return {'ek': b'', 'cek': dk, 'header': h}