<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_id(arguments_dict):
 """ Get and validate the `user_id` argument to a task derived from `UserTaskMixin`. Arguments: arguments_dict (dict):
 The parsed positional and keyword arguments to the task Returns ------- int: The primary key of a user record (may not be an int if using a custom user model) """

    if 'user_id' not in arguments_dict:
        raise TypeError('Each invocation of a UserTaskMixin subclass must include the user_id')
    user_id = arguments_dict['user_id']
    try:
        get_user_model().objects.get(pk=user_id)
    except (ValueError, get_user_model().DoesNotExist):
        raise TypeError('Invalid user_id: {}'.format(user_id))
    return user_id