def get_child(parent, selector, index=0):
    """Get a child element from parent matching the specified CSS selector at the specified zero-based index"""

    children = parent.cssselect(selector)
    if children is not None and ((index >= 0 and len(children) > index) or (index < 0 and len(children) >= abs(index))):
        return children[index]