<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def swagger(self):
 """ some preparation before returning Swagger object """

        # prepare Swagger.host & Swagger.basePath
        if not self.__swagger:
            return None

        common_path = os.path.commonprefix(list(self.__swagger.paths))
        # remove tailing slash,
        # because all paths in Paths Object would prefixed with slah.
        common_path = common_path[:-1] if common_path[-1] == '/' else common_path

        if len(common_path) > 0:
            p = six.moves.urllib.parse.urlparse(common_path)
            self.__swagger.update_field('host', p.netloc)

            new_common_path = six.moves.urllib.parse.urlunparse((
                p.scheme, p.netloc, '', '', '', ''))
            new_path = {}
            for k in self.__swagger.paths.keys():
                new_path[k[len(new_common_path):]] = self.__swagger.paths[k]
            self.__swagger.update_field('paths', new_path)

        return self.__swagger