<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, user_id, expand=False):
 """Returns Hacker News `User` object. Fetches data from the url: https://hacker-news.firebaseio.com/v0/user/<user_id>.json e.g. https://hacker-news.firebaseio.com/v0/user/pg.json Args: user_id (string):
 unique user id of a Hacker News user. expand (bool):
 Flag to indicate whether to transform all IDs into objects. Returns: `User` object representing a user on Hacker News. Raises: InvalidUserID: If no such user exists on Hacker News. """

        url = urljoin(self.user_url, F"{user_id}.json")
        response = self._get_sync(url)

        if not response:
            raise InvalidUserID

        user = User(response)
        if expand and user.submitted:
            items = self.get_items_by_ids(user.submitted)
            user_opt = {
                'stories': 'story',
                'comments': 'comment',
                'jobs': 'job',
                'polls': 'poll',
                'pollopts': 'pollopt'
            }
            for key, value in user_opt.items():
                setattr(
                    user,
                    key,
                    [i for i in items if i.item_type == value]
                )

        return user