import pathlib


def get_message(message):

    """
        get message from file or string format and return it.

        Args:
            message: str or Path.file path to the cleartext or cleartext itself.

        Returns:
            message: str.cleartext
    """
    if not isinstance(message, str) and not isinstance(message, pathlib.Path):
        print("input str object or Path object.aborting...")
        exit()
    if isinstance(message, str):
        if message == "":
            print("message is empty.aborting...")
            exit()
        else:
            return message
    else:
        try:
            with message.open() as f:
                message = f.read()

            if message == "":
                print("message is empty.aborting...")
                exit()

            return message
        except UnicodeDecodeError:
            print("file is binary.aborting...")
            exit()