if statement to check if return value is a dictionary