'Set or unset a Link as the sticky in its subreddit.
`state` is a boolean that indicates whether to sticky or unsticky
this post - true to sticky, false to unsticky.
The `num` argument is optional, and only used when stickying a post.
It allows specifying a particular "slot" to sticky the post into, and
if there is already a post stickied in that slot it will be replaced.
If there is no post in the specified slot to replace, or `num` is None,
the bottom-most slot will be used.'

@require_oauth2_scope('modposts')
@validatedForm(VUser(), VModhash(), VSrCanBan('id'), thing=VByName('id'), state=VBoolean('state'), num=VInt('num', min=1, max=Subreddit.MAX_STICKIES, coerce=True), timeout=VNotInTimeout('id'))
@api_doc(api_section.links_and_comments)
def POST_set_subreddit_sticky(self, form, jquery, thing, state, num, timeout):

    if (not isinstance(thing, Link)):
        return
    sr = thing.subreddit_slow
    stickied = thing.is_stickied(sr)
    if ((not stickied) and (thing._deleted or thing._spam)):
        abort(400, "Can't    sticky    a    removed    or    deleted    post")
    if state:
        if (not thing.is_stickyable()):
            abort(400, 'Post    not    stickyable')
        if stickied:
            abort(409, 'Already    stickied')
        sr.set_sticky(thing, c.user, num=num)
    else:
        sr.remove_sticky(thing, c.user)
    jquery.refresh()
