<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def GET_names( self, path_info ):
 """ Get all names in existence If `all=true` is set, then include expired names. Returns the list on success Returns 400 on invalid arguments Returns 502 on failure to get names """


        include_expired = False

        qs_values = path_info['qs_values']
        page = qs_values.get('page', None)
        if page is None:
            log.error("Page required")
            return self._reply_json({'error': 'page= argument required'}, status_code=400)

        try:
            page = int(page)
            if page < 0:
                raise ValueError("Page is negative")

        except ValueError:
            log.error("Invalid page")
            return self._reply_json({'error': 'Invalid page= value'}, status_code=400)

        if qs_values.get('all', '').lower() in ['1', 'true']:
            include_expired = True

        offset = page * 100
        count = 100

        blockstackd_url = get_blockstackd_url()
        res = blockstackd_client.get_all_names(offset, count, include_expired=include_expired, hostport=blockstackd_url)
        if json_is_error(res):
            log.error("Failed to list all names (offset={}, count={}): {}".format(offset, count, res['error']))
            return self._reply_json({'error': 'Failed to list all names'}, status_code=res.get('http_status', 502))

        return self._reply_json(res)