import re


def extract_citations(tree):
    """
    Extract number of citations from a given eutils XML tree.

    Parameters
    ----------
    tree: Element
        An lxml Element parsed from eutil website

    Return
    ------
    n_citations: int
        Number of citations that an article get until parsed date. If no citations found, return 0
    """
    citations_text = tree.xpath('//form/h2[@class="head"]/text()')[0]
    n_citations = re.sub("Is Cited by the Following ", "", citations_text).split(" ")[0]
    try:
        n_citations = int(n_citations)
    except:
        n_citations = 0
    return n_citations