def _detect_artifact(artifact_id):
    """Detects type of artifact based on artifact URL.

    Parameters
    ----------
    artifact_id : str
        String in form of resolvable URL

    Returns
    -------
    artifact_type : str
        String representing artifact type, it can be ['field',element', 'template' or 'instance template']
    artifact_url_str : str
        Unique string from the artifact id representing artifact_type
    """

    artifact_type = {
        "field": "/template-fields/",
        "element": "/template-elements/",
        "template": "/templates/",
        "instance": "/template-instances/",
    }
    if artifact_id.find(artifact_type["field"]) != -1:
        return "field", artifact_type["field"].replace("/", "")
    if artifact_id.find(artifact_type["element"]) != -1:
        return "element", artifact_type["element"].replace("/", "")
    if artifact_id.find(artifact_type["template"]) != -1:
        return "template", artifact_type["template"].replace("/", "")
    if artifact_id.find(artifact_type["instance"]) != -1:
        return "instance", artifact_type["instance"].replace("/", "")
    else:
        raise ValueError(
            "artifact_id does not contain information about CEDAR artifact."
        )