Write a function in Python to get the number of occurrences of a particular character in a given sentence.
sentence = "Hello world!"
character = 'l'
def count_occurrences(sentence, character): 
    return sentence.count(character)