<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def init_app(self, app):
 """ Initialises the Negotiate extension for the given application. """

        if not hasattr(app, 'extensions'):
            app.extensions = {}

        service_name = app.config.get('GSSAPI_SERVICE_NAME', 'HTTP')
        hostname = app.config.get('GSSAPI_HOSTNAME', socket.getfqdn())
        principal = '{}@{}'.format(service_name, hostname)
        name = gssapi.Name(principal, gssapi.NameType.hostbased_service)

        app.extensions['gssapi'] = {
            'creds': gssapi.Credentials(name=name, usage='accept'),
        }