def window_landmark(region, flank_upstream=50, flank_downstream=50, ref_delta=0, landmark=0):
    """Define a window surrounding a landmark in a region, if the region has such a landmark,
    (e.g. a start codon in a transcript), accounting for splicing of the region,
    if the region is discontinuous
    
    Parameters
    ----------
    transcript : |SegmentChain| or |Transcript|
        Region on which to generate a window surrounding a landmark
    
    landmark : int
        Position of the landmark within `region`

    flank_upstream : int
        Nucleotides upstream of `landmark` to include in window
    
    flank_downstream : int
        Nucleotides downstream of `landmark` to include in window
    
    ref_delta : int
        Offset from `landmark` to the reference point. If 0, the landmark
        is the reference point. Default: 0
    
    
    Returns
    -------
    |SegmentChain|
        Window of `region` surrounding landmark
    
    int
        alignment offset to the window start, if `region` itself wasn't long
        enough in the 5' direction to include the entire distance specified by
        `flank_upstream`. Use this to align windows generated around similar
        landmarks from different `regions` (e.g. windows surrounding start codons
        in various transcripts).

    (str, int, str)
        Genomic coordinate of reference point as *(chromosome name, coordinate, strand)*
    """
    if landmark + ref_delta >= flank_upstream:
        fiveprime_offset = 0
        my_start = landmark + ref_delta - flank_upstream
    else:
        fiveprime_offset = flank_upstream - landmark
        my_start = 0

    my_end = min(region.length, landmark + ref_delta + flank_downstream)
    roi = region.get_subchain(my_start, my_end)
    span = region.spanning_segment
    chrom = span.chrom
    strand = span.strand

    if landmark + ref_delta == region.length:
        if span.strand == "+":
            ref_point = (chrom, span.end, strand)
        else:
            ref_point = (chrom, span.start - 1, strand)
    else:
        ref_point = region.get_genomic_coordinate(landmark + ref_delta)

    return roi, fiveprime_offset, ref_point