<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _add_auth(self):
 """ Add Auth configuration to the Swagger file, if necessary """


        if not self.auth:
            return

        if self.auth and not self.definition_body:
            raise InvalidResourceException(self.logical_id,
                                           "Auth works only with inline Swagger specified in "
                                           "'DefinitionBody' property")

        # Make sure keys in the dict are recognized
        if not all(key in AuthProperties._fields for key in self.auth.keys()):
            raise InvalidResourceException(
                self.logical_id, "Invalid value for 'Auth' property")

        if not SwaggerEditor.is_valid(self.definition_body):
            raise InvalidResourceException(self.logical_id, "Unable to add Auth configuration because "
                                                            "'DefinitionBody' does not contain a valid Swagger")
        swagger_editor = SwaggerEditor(self.definition_body)
        auth_properties = AuthProperties(**self.auth)
        authorizers = self._get_authorizers(auth_properties.Authorizers, auth_properties.DefaultAuthorizer)

        if authorizers:
            swagger_editor.add_authorizers(authorizers)
            self._set_default_authorizer(swagger_editor, authorizers, auth_properties.DefaultAuthorizer)

        # Assign the Swagger back to template
        self.definition_body = swagger_editor.swagger