Generate a program in Python to count the occurrence of an element in a given list
def count_element(list, element):
    count = 0
    for i in list:
        if i == element:
            count += 1
    return count