def isalnum( string, allowed_extra_chars='' ):
    """ check if the given string only contains alpha-numeric characters + optionally allowed extra chars """

    stripped_name = string.translate( None, allowed_extra_chars )

    return stripped_name.isalnum()