<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_collections(self, username="", calculate_size=False, ext_preload=False, offset=0, limit=10):
 """Fetch collection folders :param username: The user to list folders for, if omitted the authenticated user is used :param calculate_size: The option to include the content count per each collection folder :param ext_preload: Include first 5 deviations from the folder :param offset: the pagination offset :param limit: the pagination limit """


        if not username and self.standard_grant_type == "authorization_code":
            response = self._req('/collections/folders', {
                "calculate_size":calculate_size,
                "ext_preload":ext_preload,
                "offset":offset,
                "limit":limit
            })
        else:
            if not username:
                raise DeviantartError("No username defined.")
            else:
                response = self._req('/collections/folders', {
                    "username":username,
                    "calculate_size":calculate_size,
                    "ext_preload":ext_preload,
                    "offset":offset,
                    "limit":limit
                })

        folders = []

        for item in response['results']:
            f = {}
            f['folderid'] = item['folderid']
            f['name'] = item['name']

            if "size" in item:
                f['size'] = item['size']

            if "deviations" in item:
                f['deviations'] = []

                for deviation_item in item['deviations']:
                    d = Deviation()
                    d.from_dict(deviation_item)
                    f['deviations'].append(d)

            folders.append(f)

        return {
            "results" : folders,
            "has_more" : response['has_more'],
            "next_offset" : response['next_offset']
        }