import string


def is_alnum(a_string, okchars=None):
    """
    Checks if the *a_string* contains alnum characters (i.e like string.alnum) but allows you
    to also include specific characters which you want to allow. Returns false
    if a character in *a_string* is not alphanumeric and not one of *okchars*
    """

    if okchars:
        _oklist = list(string.ascii_letters + string.digits) + list(okchars)
    else:
        _oklist = list(string.ascii_letters + string.digits)

    str_list = list(a_string)
    for s in str_list:
        if s not in _oklist:
            return False

    return True