def get_class(kls):
    """
    Converts a string to a class.
    Courtesy:
    http://stackoverflow.com/q/452969/#452981
    """
    parts = kls.split('.')
    module = '.'.join(parts[:-1])
    m = __import__(module)
    for comp in parts[1:]:
        m = getattr(m, comp)
    return m
