def insert_tool(tools, tool, allowed_instances):
    """ Add tool to list if tool is sub class
    of one item in allowed_instances
    """
    allowed_instances = allowed_instances or [object]
    for check_instance in allowed_instances:
        if isinstance(tool, type) and issubclass(tool, check_instance):
            tools.append(tool)
            break
