def search(variable: str, target: str) -> str:
    """Search serice using mwapi on wikidata

    Args:
        variable (str): variable name (?film, ?director...)
        target (str): value to search for

    Returns:
        str: service query
    """

    if variable is None or target is None:
        return ""
    return f"""
    SERVICE wikibase:mwapi {{
      bd:serviceParam wikibase:api "EntitySearch" .
      bd:serviceParam wikibase:endpoint "www.wikidata.org" .
      bd:serviceParam mwapi:search "{target}" .
      bd:serviceParam mwapi:language "en" .
      {variable} wikibase:apiOutputItem mwapi:item .
    }}
    """