def _get_api_events(self, function):
if not (function.valid() and<EOL>isinstance(function.properties, dict) and<EOL>isinstance(function.properties.get("<STR_LIT>"), dict)<EOL>):<EOL><INDENT>return {}<EOL><DEDENT>api_events = {}<EOL>for event_id, event in function.properties["<STR_LIT>"].items():<EOL><INDENT>if event and isinstance(event, dict) and event.get("<STR_LIT>") == "<STR_LIT>":<EOL><INDENT>api_events[event_id] = event<EOL><DEDENT><DEDENT>return api_events<EOL>
Method to return a dictionary of API Events on the function

:param SamResource function: Function Resource object
:return dict: Dictionary of API events along with any other configuration passed to it.
    Example: {
        FooEvent: {Path: "/foo", Method: "post", RestApiId: blah, MethodSettings: {<something>},
                    Cors: {<something>}, Auth: {<something>}},
        BarEvent: {Path: "/bar", Method: "any", MethodSettings: {<something>}, Cors: {<something>},
                    Auth: {<something>}}"
    }