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

def denormalize_attachment(attachment):
        '''convert attachment metadata from archivant to es format'''
        res = dict()
        ext = ['id', 'url']
        for k in ext:
            if k in attachment['metadata']:
                raise ValueError("metadata section could not contain special key '{}'".format(k))
            res[k] = attachment[k]
        res.update(attachment['metadata'])
        return res