def METHOD_NAME(dir):
    if (not os.path.isdir(dir)):
        sys.stderr.write("%s not found, but indexed in parent summary.json\n" % dir)
        emptycat = collections.OrderedDict()
        emptycat["categories"] = []
        emptycat["examples"] = []
        return emptycat
    dirnames = [entry for entry in os.listdir(dir) if os.path.isdir(os.path.join(dir,entry))]
    index = collections.OrderedDict()
    subdirs = {}
    category = collections.OrderedDict()
    category["name"] = os.path.basename(dir)
    category["displayName"] = ""
    category["description"] = ""
    category["categories"] = []
    category["examples"] = []
    summary_json_file = os.path.join(dir, "summary.json")
    if (os.path.isfile(summary_json_file)):
        with open(summary_json_file) as json_file:
            data = json.load(json_file)
            if data.get("overview"):
                category["displayName"] = data.get("overview")
            if data.get("description"):
                category["description"] = data.get("description")
            if data.get("subdirs"):
                subdirs = data["subdirs"]
    if (not subdirs):
        subdirs = dirnames
    subdirs = sorted(subdirs)
    # TODO: Sort subdirs
    for subdir in subdirs:
        if (subdir.startswith(".")):
            continue
        path = os.path.join(dir, subdir)
        example_file = os.path.join(path, "description.json")
        if (os.path.isfile(example_file)):
            example = addexample(path)
            if example is not None:
                category["examples"].append(example)
        else:
            subcategory = METHOD_NAME(path)
            if (subcategory is not None):
                category["categories"].append(subcategory)
    if (len(category["categories"]) + len(category["examples"]) > 0):
        return category
    return None