<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_user(self, username="", ext_collections=False, ext_galleries=False):
 """Get user profile information :param username: username to lookup profile of :param ext_collections: Include collection folder info :param ext_galleries: Include gallery folder info """


        if not username and self.standard_grant_type == "authorization_code":
            response = self._req('/user/whoami')
            u = User()
            u.from_dict(response)
        else:
            if not username:
                raise DeviantartError("No username defined.")
            else:
                response = self._req('/user/profile/{}'.format(username), {
                    'ext_collections' : ext_collections,
                    'ext_galleries' : ext_galleries
                })
                u = User()
                u.from_dict(response['user'])

        return u