def get_child(parent, selector, index=0):
	"""Get the child element of parent as specified by the given CSS selector

	If index is specified, return the matching child element at the specified zero-based index; otherwise, return the first matching child element.
	"""

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