code: def get_variant(self, index=None):
          
          for variant in self.iter_variants():
              if variant.index == index:
                  return variant
docs: Get the variant with the associated index.
  
          Returns:
              `Variant` object, or None if no variant with the given index exists.