from typing import Any


def get_file_for_upload(
    file_name: str, file_object_or_path: Any, read_mode: str = "rb"
) -> tuple:
    """
    takes file_name and file_object_or_path and formats files in a way that is acceptable to Python
    requests for multipart encoded file.
    if type(file_object_or_path) == str, then we convert to a readable object

    Args:
        file_name (str): file name to assign to file_object_or_path
        file_object_or_path (Any): should be either a file path or a readable file object
        read_mode (str, optional): only relevant if as_path == True. read mode for opening file (eg 'rb', 'r'). Defaults to 'rb'.

    Returns:
        tuple: multipart form encoded file format: ('file', (file_name, readable_file_object))
    """
    if type(file_object_or_path) == str:
        return ("file", (file_name, open(file_object_or_path, read_mode)))
    else:
        return ("file", (file_name, file_object_or_path))