def has_only(string, chars):

    """
    Check whether the string contains only the specified characters.
    """
    
    for char in string:
        if not char in chars: return False
    return True