human
Solve the following python programming problem given the following code:
def _report_user_dict(user) : 
    "
    Accepts a user object or a dict such as that returned from elasticsearch.
    Make sure the following fields are available:
    ['_id', 'username', 'first_name', 'last_name', 'doc_type', 'is_active']
    " 
    if (not isinstance (user, dict)) : 
        user_report_attrs = ['user_id', 'username_in_report', 'raw_username', 'is_active'] 
        return SimplifiedUserInfo (** { attr : getattr (user, attr) for attr in user_report_attrs }) 
else : 
        username = user.get ('username', '') 
        raw_username = (username.split ('@') [0] if (user.get ('doc_type', '') == 'CommCareUser') else last) 
        first = user.get ('first_name', '') 
        last = user.get ('last_name', '') 
        full_name = ('%s %s' % (first, last)).strip () 
        def parts() : 
            (yield ('%s' % html.escape (raw_username))) 
            if full_name : 
                (yield (' "%s"' % html.escape (full_name))) 
username_in_report = safestring.mark_safe (''.join (parts ())) 
        return SimplifiedUserInfo (user_id = user.get ('_id', ''), username_in_report = username_in_report, raw_username = raw_username, is_active = user.get ('is_active', None)) 

    
    

    Fix the buggy line: raw_username = (username.split ('@') [0] if (user.get ('doc_type', '') == 'CommCareUser') else last)
assistant
#Here is Python program to fix the buggy line: raw_username = (username.

raw_username = (username.split ('@') [0] if (user.get ('doc_type', '') == 'CommCareUser') else username)