def count_bigram(sequence, first, second):
    """
    counts the number of occurrences of a given bigram  in a sequence.

    Parameters
    ----------
    sequence : str
        The DNA sequence to be analysed.
    first : char
        the first letter of the bigram to be considered.
    second : char
        the second letter of the bigram to be considered.

    Returns
    -------
    int
        the number of occurrences of the bigram.

    """
    count = 0
    cmp = False
    for char in sequence:
        if cmp is True:
            cmp = False
            if char == second:
                count += 1
        if char == first:
            cmp = True
    return count