def import_cvxpy():
    """
    Try importing the qutip module, log an error if unsuccessful.

    :return: The cvxpy module if successful or None
    :rtype: Optional[module]
    """
    global _CVXPY_ERROR_LOGGED
    try:
        import cvxpy
    except ImportError:  # pragma no coverage
        cvxpy = None
        if not _CVXPY_ERROR_LOGGED:
            _log.error("Could not import cvxpy. Tomography tools will not function.")
            _CVXPY_ERROR_LOGGED = True
    return cvxpy
Try importing the qutip module, log an error if unsuccessful.

    :return: The cvxpy module if successful or None
    :rtype: Optional[module]