def str_consists_of_only(haystack, needles):
    """
    Return True if haystack consists of characters only in needles.

    :type haystack: str
    :type needles: str
    :param needles: can eithter be a string, or a list of strings.
    :return: True if haystack consists of characters only in needles.
    :rtype: bool

    haystack1 = "54654645"
    numbers = "0123456789"
    print(str_consists_of_only(haystack1, numbers))  # True

    haystack1 = "xx54654645"
    numbers = "0123456789"
    print(str_consists_of_only(haystack1, numbers))  # False
    """
    assert isinstance(haystack, str)
    assert isinstance(needles, (list, str))
    if isinstance(needles, list):
        assert isinstance(needles[0], str)

    for char in needles:
        haystack = haystack.replace(char, "")

    if haystack:
        # something left.
        # that means, haystack has some characters that are not in needles.
        result = False
    else:
        # all the characters are replaced.
        # that means, haystack consists of characters only in needles.
        result = True
    return result