def convert_collection_to_stack(_collection): return Stack(*_collection.values()) if isinstance(_collection, dict) else Stack(*_collection) class Stack: def __init__(self, *args): self._collection = list(args) if len(args) else [] def push(self, item): self._collection.append(item) def pop(self): return self._collection.pop() if len(self._collection) else None def get_stack_as_list(self): return self._collection