'Helper function for building an attribute dictionary.'

def build_attrs(self, extra_attrs=None, **kwargs):

    attrs = dict(self.attrs, **kwargs)
    if extra_attrs:
        attrs.update(extra_attrs)
    return attrs
