Parse json contents of string or file object or file path and return python nested dict/lists

def read_json(file_or_path):
    """Parse json contents of string or file object or file path and return python nested dict/lists"""
    try:
        with (open(file_or_path, 'r') if isinstance(file_or_path, (str, bytes)) else file_or_path) as f:
            obj = json.load(f)
    except IOError:
        obj = json.loads(file_or_path)
    return obj