code: def sort_by_tag(self, tag):
          
          return AmpalContainer(sorted(self, key=lambda x: x.tags[tag]))
docs: Sorts the `AmpalContainer` by a tag on the component objects.
  
          Parameters
          ----------
          tag : str
              Key of tag used for sorting.