def dynamic_import_class(name):
    """
    Dynamically import a class defined by a string

    Parameters
    ----------
    name : str
        String describing the class that should be imported like a normal
        python import.

    Returns
    -------
    class : Object
        Class that is imported by the given 'name'

    Notes
    -----
    Taken from
    https://stackoverflow.com/questions/547829/how-to-dynamically-load-a-python-class

    Examples
    --------
    dynamic_import_class(pyCameras.cameraUSB.CameraUSB) will return CameraUSB
    """
    # split import path into package and desired class, import package, and
    # return class from package
    mod, cls = name.rsplit('.', 1)
    mod = __import__(mod, fromlist=[cls])
    return getattr(mod, cls)