def parse_link_label(parser, content):
    """parse link's label in format: [label] (link), return the position of the end
    of label, None if cannot be satisfied"""
    start_pos = content.pos
    if content.peek() != '[':
        return None
    content.advance()
    level = 1
    ret = None
    while not content.is_end():
        if content.peek() == ']':
            content.advance()
            level -= 1
            if level == 0:
                break
        old_pos = content.pos
        parser.skip_token(content)
        if content.peek() == '[':
            content.advance()
            level += 1
        if content.peek() != ']' and content.pos == old_pos:
            content.advance()
    if level == 0:
        ret = content.string[start_pos + 1:content.pos - 1]
    else:
        content.pos = start_pos
    return ret
