i am new to serverless framework and aws, and i need to create a lambda function on python that will send email whenever an ec2 is shut down, but i really don't know how to do it using serverless. So please if any one could help me do that or at least give me some tracks to start with.
You can use CloudWatch for this.
You can create a cloudwatch rule

Service Name -  Ec2 
Event Type - EC2 Instance change notification
Specific state(s) - shutting-down

Then use an SNS target to deliver email.
send email whenever ec2 is shut down using serverless