def __enter__(self):
    if (__maya_version__ >= 2018):
        self._previousContext = self.makeCurrent()
        return self
    else:
        cmds.error(("'%s' does not support context manager functionality for Maya 2017 and below" % self.__class__.__name__))
def __enter__(self):
    if (__maya_version__ >= 2018):
        self._previousContext = self.makeCurrent()
        return self
    else:
        cmds.error(("'%s' does not support context manager functionality for Maya 2017 and below" % self.__class__.__name__))