<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def restbase(self, endpoint, title):
 """ Returns RESTBase query string """

        if not endpoint:
            raise ValueError("invalid endpoint: %s" % endpoint)

        route = endpoint
        if title and endpoint != '/page/':
            route = endpoint + safequote_restbase(title)

        self.set_status('restbase', route)

        return "%s/api/rest_v1/%s" % (self.uri, route[1:])