import typing
import hashlib


def fill_template(template: str, entity: str, object: str) -> typing.Tuple[str, str]:
    """Fill in an FC template with an entity name and the value.

    Arguments:
        template: ``str`` A fact checking template.
        entity: ``str`` The name of the AmbER set to fill into the template.
        object: ``str`` The value of the AmbER set tuple.
    Returns:
        query: ``str`` The template with the name and object slotted in.
        query_hashlib: ``str`` A MD5 hash of the query.
    """
    query = template.replace("$entity", entity).replace("$object", object)
    assert entity in query and object in query
    query_hashlib = hashlib.md5(query.encode("utf-8")).hexdigest()
    return query, query_hashlib