import re


def is_valid_id(id_):
    """Test if on allowed chars are in id.
    
    These chars are: [A-Za-z0-9_.\\-~]
    See RFC3986#section-2.3
    # Possibly extend to IRI?
    """
    if not re.match(r'^[%A-Za-z0-9_.\\\-~]*$', id_):
        return False
    return True