def segment_kmers(string: str, k: int = 1) -> list:
    """Segment a string in k-mers: segments of length k. Note that the final
    segment might be shorter than k.

    >>> segment_kmers('abcdefghijklmno', k=2)
    ['ab', 'cd', 'ef', 'gh', 'ij', 'kl', 'mn', 'o']
    >>> segment_kmers('abcdefghijklmno', k=3)
    ['abc', 'def', 'ghi', 'jkl', 'mno']
    >>> segment_kmers('abcdefghijklmno', k=4)
    ['abcd', 'efgh', 'ijkl', 'mno']

    Parameters
    ----------
    string : str
        The string to segment
    k : int, optional
        The length k of the segments, by default 1
    
    Returns
    -------
    list
        A list of segments
    """
    segments = []
    for i in range(0, len(string), k):
        segment = string[i:i+k]
        segments.append(segment)
    return segments