def contains(text, pattern):
    """Return a boolean indicating whether pattern occurs in text."""
    assert isinstance(text, str), 'text is not a string: {}'.format(text)
    assert isinstance(pattern, str), 'pattern is not a string: {}'.format(text)
    index = 0
    if len(pattern) == 0:
        return True
    for letter in text:
        if index > 0 and letter != pattern[index]:
             index = 0
        if letter == pattern[index]:
            index += 1
        if index > len(pattern) - 1:
            return True
    return False