Returns the protocol version that should be used.

        If the version wasn't established yet, asks the server what
        versions it supports and picks the highest one.

def _protocol_version(self):
        """Returns the protocol version that should be used.

        If the version wasn't established yet, asks the server what
        versions it supports and picks the highest one.
        """
        if hasattr(self, '_protocol_ver'):
            return self._protocol_ver

        response = requests.get(self.base_url + '/version/')

        if response.status_code == 404:
            server_versions = {1}
        elif response.status_code == 200:
            server_versions = set(response.json()['protocol_versions'])
            if not server_versions:
                raise FiletrackerError(
                        'Server hasn\'t reported any supported protocols')
        else:
            response.raise_for_status()

        common_versions = _SUPPORTED_VERSIONS.intersection(server_versions)
        if not common_versions:
            raise FiletrackerError(
                    'Couldn\'t agree on protocol version: client supports '
                    '{}, server supports {}.'
                    .format(_PROTOCOL_CAPABILITIES, server_versions))

        self._protocol_ver = max(common_versions)
        print('Settled for protocol version {}'.format(self._protocol_ver))

        return self._protocol_ver