def create_bookmark(user, usage_key):
 usage_key = usage_key.replace(course_key=modulestore().fill_in_run(usage_key.course_key))
 data = {'user': user, 'usage_key': usage_key}
 if (usage_key.course_key.run is None):
  raise ItemNotFoundError
 if (not can_create_more(data)):
  raise BookmarksLimitReachedError
 (bookmark, created) = Bookmark.create(data)
 if created:
  _track_event('edx.bookmark.added', bookmark)
 return BookmarkSerializer(bookmark, context={'fields': (DEFAULT_FIELDS + OPTIONAL_FIELDS)}).data

def create_bookmark ( user , usage_key ) : usage_key = usage_key . replace ( course_key = modulestore ( ) . fill_in_run ( usage_key . course_key ) ) data = { 'user' : user , 'usage_key' : usage_key } if ( usage_key . course_key . run is None ) : raise ItemNotFoundError if ( not can_create_more ( data ) ) : raise BookmarksLimitReachedError ( bookmark , created ) = Bookmark . create ( data ) if created : _track_event ( 'edx.bookmark.added' , bookmark ) return BookmarkSerializer ( bookmark , context = { 'fields' : ( DEFAULT_FIELDS + OPTIONAL_FIELDS ) } ) . data
create a bookmark .