def nb_coverage_distance(epitope, peptide, mmTolerance = 0):
    """Determines whether pepitide covers epitope
    and can handle epitopes and peptides of different lengths.

    To be a consistent distance matrix:
        covered = 0
        not-covered = 1

    If epitope is longer than peptide it is not covered.
    Otherwise coverage is determined based on a mmTolerance

    Parameters
    ----------
    epitope : np.array
    peptide : np.array
    mmTolerance : int
        Number of mismatches tolerated
        If dist <= mmTolerance then it is covered

    Returns
    -------
    covered : int
        Covered (0) or not-covered (1)"""

    LEpitope, LPeptide = len(epitope), len(peptide)
    if LEpitope > LPeptide:
        return 1

    for starti in range(LPeptide-LEpitope+1):
        mm = 0
        for k in range(LEpitope):
            if epitope[k] != peptide[starti + k]:
                mm = mm + 1
                if mm > mmTolerance:
                    """If this peptide is already over the tolerance then goto next one"""
                    break
        if mm <= mmTolerance:
            """If this peptide is below tolerance then return covered (0)"""
            return 0
    """If no peptides meet mmTolerance then return not covered"""
    return 1