<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_hook(self, auth, repo_name, hook_type, config, events=None, organization=None, active=False):
 """ Creates a new hook, and returns the created hook. :param auth.Authentication auth: authentication object, must be admin-level :param str repo_name: the name of the repo for which we create the hook :param str hook_type: The type of webhook, either "gogs" or "slack" :param dict config: Settings for this hook (possible keys are ``"url"``, ``"content_type"``, ``"secret"``) :param list events: Determines what events the hook is triggered for. Default: ["push"] :param str organization: Organization of the repo :param bool active: Determines whether the hook is actually triggered on pushes. Default is false :return: a representation of the created hook :rtype: GogsRepo.Hook :raises NetworkFailure: if there is an error communicating with the server :raises ApiFailure: if the request cannot be serviced """

        if events is None:
            events = ["push"]  # default value is mutable, so assign inside body

        data = {
            "type": hook_type,
            "config": config,
            "events": events,
            "active": active
        }

        url = "/repos/{o}/{r}/hooks".format(o=organization, r=repo_name) if organization is not None \
            else "/repos/{r}/hooks".format(r=repo_name)
        response = self.post(url, auth=auth, data=data)
        return GogsRepo.Hook.from_json(response.json())