':calls: `POST /repos/:owner/:repo/hooks <http://developer.github.com/v3/repos/hooks>`_
:param name: string
:param config: dict
:param events: list of string
:param active: bool
:rtype: :class:`github.Hook.Hook`'

def create_hook(self, name, config, events=github.GithubObject.NotSet, active=github.GithubObject.NotSet):

    assert isinstance(name, (str, unicode)), name
    assert isinstance(config, dict), config
    assert ((events is github.GithubObject.NotSet) or all((isinstance(element, (str, unicode)) for element in events))), events
    assert ((active is github.GithubObject.NotSet) or isinstance(active, bool)), active
    post_parameters = {'name': name, 'config': config}
    if (events is not github.GithubObject.NotSet):
        post_parameters['events'] = events
    if (active is not github.GithubObject.NotSet):
        post_parameters['active'] = active
    (headers, data) = self._requester.requestJsonAndCheck('POST', (self.url + '/hooks'), input=post_parameters)
    return github.Hook.Hook(self._requester, headers, data, completed=True)
