import json


def is_json(to_test):
    """Function to test if data is shaped like JSON.

    :param to_test: String or bytes
    :type to_test: requests.models.Response
    :return: True if shaped like JSON, False if not.
    :rtype: bool
    """
    if isinstance(to_test, bytes):
        as_str = to_test.decode('utf-8')
    else:
        as_str = str(to_test)
    try:
        json.loads(as_str)
    except ValueError:
        return False
    return True