<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def all(cls, state=None, include_deactivated=False):
 """ Get all organisations :param state: State of organisation :param include_deactivated: Flag to include deactivated :returns: list of Organisation instances :raises: SocketError, CouchException """

        if state and state not in validators.VALID_STATES:
            raise exceptions.ValidationError('Invalid "state"')
        elif state:
            organisations = yield views.organisations.get(key=state,
                                                          include_docs=True)
        elif include_deactivated:
            organisations = yield views.organisations.get(include_docs=True)
        else:
            organisations = yield views.active_organisations.get(include_docs=True)

        raise Return([cls(**org['doc']) for org in organisations['rows']])