Write a Python function to check if a given substring is contained in a string.
String = "This is an example"
SubString = "ex"
def check_substring(String, SubString):
    if SubString in String : 
        return True
    else: 
        return False