def get_image_name(name: str, tag: str, image_prefix: str = "") -> str:
    """Get a valid versioned image name.

    Args:
        name (str): Name of the docker image.
        tag (str): Version to use for the tag.
        image_prefix (str, optional): The prefix added to the name to indicate an organization on DockerHub or a completely different repository.

    Returns:
        str: a valid docker image name based on: prefix/name:tag
    """
    versioned_tag = name.strip() + ":" + tag.strip()
    if image_prefix:
        versioned_tag = image_prefix.strip().rstrip("/") + "/" + versioned_tag
    return versioned_tag