All I am sharing is a one line function. custom_attrs. I have shared this before, but pretty sure I was only returning the attrs not the attrs and values. But ok, its not much. I have an example below that looks pretty lame. But I wanted it for getting custom attrs from a UIFile/pyui file.
Just std python, but as a beginner I still struggle with different types of comprehensions.
Btw, it works. Not to say it couldn't be written better/faster.

import ui

def custom_attrs(v):
    # returns a dict with k,v found in v(iew) that are not ui.View
    return {key:getattr(v, key) for key in
            list(set(v.__dict__) - set(vars(ui.View)))}

class MyClass(ui.View):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.a = None
        self.b = 1

if __name__ == '__main__':
    mc = MyClass(bg_color = 'white')
    mc.present('sheet')
    print(custom_attrs(mc))