This functionality now also appears to be repeated multiple times in this file.

It would be great if you could refactor this into a separate function (e.g. `_extract_extra_attributes` or something like that) which takes extraction definition (basically, `extra_attributes_map` argument) and returns a ``dict`` with extracted attributes.