def fetch_friends(self):
    friends_json = self._fetch_json('friend/list', {'lookup': 'ALL'})
    result = []
    for friend_json in friends_json['friends']:
      flags = friend_json.get('flags', 0)
      types = friend_json.get('types', [])
      websites=[
        Website(w['title'], w['url']) for w in friend_json.get('websites', [])]
      result.append(Friend(
        stream_id=friend_json.get('stream'),

        user_ids=friend_json.get('userIds', []),
        profile_ids=friend_json.get('profileIds', []),
        contact_id=friend_json['contactId'],
        group_ids=friend_json.get('groupIds', []),

        display_name=friend_json['displayName'],
        given_name=friend_json['givenName'],
        occupation=friend_json.get('occupation'),
        websites=websites,
        location=friend_json.get('location'),
        photo_url=friend_json.get('photoUrl'),
        email_addresses=friend_json.get('emailAddresses', []),

        is_current_user= flags & 1 << 0 != 0,
        is_hidden=       flags & 1 << 1 != 0,
        is_new=          flags & 1 << 2 != 0,
        uses_reader=     flags & 1 << 3 != 0,
        is_blocked=      flags & 1 << 4 != 0,
        has_profile=     flags & 1 << 5 != 0,
        is_ignored=      flags & 1 << 6 != 0,
        is_new_follower= flags & 1 << 7 != 0,
        is_anonymous=    flags & 1 << 8 != 0,
        has_shared_items=flags & 1 << 9 != 0,

        is_follower=          0 in types,
        is_following=         1 in types,
        is_contact=           3 in types,
        is_pending_following= 4 in types,
        is_pending_follower=  5 in types,
        is_allowed_following= 6 in types,
        is_allowed_commenting=7 in types,
      ))
    return result
dataset/ETHPy150Open mihaip/readerisdead/base/api.py/Api.fetch_friends/original