from pathlib import Path


def get_image_path(instance, filename):
    """
    callable to define the image upload path according
    to the type of object: segment, route, etc.. as well as
    the id of the object.
    """
    return Path("images", instance.__class__.__name__, str(instance.id), filename)