def METHOD_NAME(source, path, type=None, text=False):
    path += "[string-length(normalize-space()) > 0]"
    if type:
        path += "[@type='{type}']".format(type=type)
    if text:
        path += "/text()"
        return source.xpath(path)
    return source.xpath(path)