validates a unicode string containing xml

def is_valid(xml_string):
    """validates a unicode string containing xml"""
    xml_file = StringIO.StringIO(xml_string.encode('utf-8'))
    
    parser = XmlScanner()
    parser.setContentHandler(ContentHandler())
    try:
        parser.parse(xml_file)
    except SAXParseException:
        return False
    
    return True