def get_bookmark(user, usage_key, fields=None):
 bookmarks_queryset = Bookmark.objects
 if (len((set((fields or [])) & set(OPTIONAL_FIELDS))) > 0):
  bookmarks_queryset = bookmarks_queryset.select_related('user', 'xblock_cache')
 else:
  bookmarks_queryset = bookmarks_queryset.select_related('user')
 bookmark = bookmarks_queryset.get(user=user, usage_key=usage_key)
 return BookmarkSerializer(bookmark, context={'fields': fields}).data

def get_bookmark ( user , usage_key , fields = None ) : bookmarks_queryset = Bookmark . objects if ( len ( ( set ( ( fields or [ ] ) ) & set ( OPTIONAL_FIELDS ) ) ) > 0 ) : bookmarks_queryset = bookmarks_queryset . select_related ( 'user' , 'xblock_cache' ) else : bookmarks_queryset = bookmarks_queryset . select_related ( 'user' ) bookmark = bookmarks_queryset . get ( user = user , usage_key = usage_key ) return BookmarkSerializer ( bookmark , context = { 'fields' : fields } ) . data
return data for a bookmark .