convert attachment metadata from archivant to es format

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