register UILayout with the flask app

        create a function that will send props for each UILayout

        Args:
            layouts (dict): dict of UILayout objects by name
            app (object): flask app
            url (string): address of props; default is /api/props/

def register_layouts(layouts, app, url="/api/props/", brand="Pyxley"):
    """ register UILayout with the flask app

        create a function that will send props for each UILayout

        Args:
            layouts (dict): dict of UILayout objects by name
            app (object): flask app
            url (string): address of props; default is /api/props/
    """
    def props(name):
        if name not in layouts:
            # cast as list for python3
            name = list(layouts.keys())[0]
        return jsonify({"layouts": layouts[name]["layout"]})

    def apps():
        paths = []
        for i, k in enumerate(layouts.keys()):
            if i == 0:
                paths.append({
                    "path": "/",
                    "label": layouts[k].get("title", k)
                })

            paths.append({
                "path": "/"+k,
                "label": layouts[k].get("title", k)
            })

        return jsonify({"brand": brand, "navlinks": paths})

    app.add_url_rule(url+"<string:name>/", view_func=props)
    app.add_url_rule(url, view_func=apps)