code: def predict_variant_effects(variant, raise_on_error=False):
      
      # if this variant isn't overlapping any genes, return a
      # Intergenic effect
      # TODO: look for nearby genes and mark those as Upstream and Downstream
      # effects
      if len(variant.gene_ids) == 0:
          effects = [Intergenic(variant)]
      else:
          # list of all MutationEffects for all genes & transcripts
          effects = []
  
          # group transcripts by their gene ID
          transcripts_grouped_by_gene = groupby_field(variant.transcripts, 'gene_id')
  
          # want effects in the list grouped by the gene they come from
          for gene_id in sorted(variant.gene_ids):
              if gene_id not in transcripts_grouped_by_gene:
                  # intragenic variant overlaps a gene but not any transcripts
                  gene = variant.ensembl.gene_by_id(gene_id)
                  effects.append(Intragenic(variant, gene))
              else:
                  # gene ID  has transcripts overlapped by this variant
                  for transcript in transcripts_grouped_by_gene[gene_id]:
                      if raise_on_error:
                          effect = predict_variant_effect_on_transcript(
                              variant=variant,
                              transcript=transcript)
                      else:
                          effect = predict_variant_effect_on_transcript_or_failure(
                              variant=variant,
                              transcript=transcript)
                      effects.append(effect)
      return EffectCollection(effects)
docs: Determine the effects of a variant on any transcripts it overlaps.
      Returns an EffectCollection object.
  
      Parameters
      ----------
      variant : Variant
  
      raise_on_error : bool
          Raise an exception if we encounter an error while trying to
          determine the effect of this variant on a transcript, or simply
          log the error and continue.