Human: Give me a Python function to top k largest elements. Assistant: 
Here is a Python function to top k largest elements

import math

def top_k_largest(array, k):
    """Return the top k largest elements of an array."""
    array.sort(reverse=True)
    return array[:k]

# Enter the array
array = [1, 2, 3, 4, 5, 6, 7, 8, 9]

# Enter the value of k
k = 3

# Calling the function
print((top_k_largest(array, k)))

#Example Output
# [9, 8, 7]

#Remember to inspect code for bugs.