added a utility function to recursively check depth of lists