To get rid of a bunch of lines and making it easier to add a new attributes, you could use a for loop.

So, something like:

```python
extra_attributes_map = {
    'availability': {
        'xpath:' 'availabilityZone',
        'type': str
    }
}

for attribute, values in extra_attributes_map.items():
   type_func = values['type']
   name = values['name']
   value = findattr(element=element, xpath=values['xpath'],
                               namespace=NAMESPACE)
   extra[attribute] = cast_func(value)
   ...
```