def valid(text, chars="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"):
    """Returns a copy of text than only contains characters in chars

    This function is case-sensitive.
    
    >>> valid("Barking")
    'B'
    >>> valid("KL754", "0123456789")
    '754'
    >>> valid("BEAN", "abcdefghijklmnopqrstuvwxyz")
    ''
    """
    result = []
    for char in text:
        if char in chars:
            result.append(char)
    return "".join(result)