def METHOD_NAME(self, instance):
    if instance.data["family"] == "background_batch":
        return os.path.basename(instance.data["source"])
    if len(instance.data["representations"]) != 1:
        raise ValueError((
            "Implementation bug: Instance data contain"
            " more than one representation."
        ))
    repre = instance.data["representations"][0]
    repre_files = repre["files"]
    if not isinstance(repre_files, str):
        raise ValueError((
            "Implementation bug: Instance's representation contain"
            " unexpected value (expected single file). {}"
        ).format(str(repre_files)))
    return repre_files