def create_treelist(dataclass, uri):
    """ create a list of resources out of a tree 

    This function is used for the COPY, MOVE and DELETE methods

    uri - the root of the subtree to flatten

    It will return the flattened tree as list

    """
    queue = [uri]
    list = [uri]
    while len(queue):
        element = queue[-1]
        if dataclass.is_collection(element):
            childs = dataclass.get_childs(element)
        else:
            childs = []
        if len(childs):
            list = list + childs
        del queue[-1]
        if len(childs):
            queue = queue + childs
    return list
