<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def scp(cls, project):
 """ Set the current project Parameters project: Project or None The project to set. If it is None, the current subproject is set to empty. If it is a sub project (see:attr:`Project.is_main`), the current subproject is set to this project. Otherwise it replaces the current main project See Also -------- scp: The global version for setting the current project gcp: Returns the current project project: Creates a new project"""

        if project is None:
            _scp(None)
            cls.oncpchange.emit(gcp())
        elif not project.is_main:
            if project.main is not _current_project:
                _scp(project.main, True)
                cls.oncpchange.emit(project.main)
            _scp(project)
            cls.oncpchange.emit(project)
        else:
            _scp(project, True)
            cls.oncpchange.emit(project)
            sp = project[:]
            _scp(sp)
            cls.oncpchange.emit(sp)