Write a python program that extracts all emails from a text.
This is a text. sender@example.com
Here is sample Python code that can be used to extract all emails from a given text:

``` python
import re

def extract_emails(text):
    email_regex = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'
    emails = re.findall(email_regex, text)
    return emails

text = 'This is a text. sender@example.com'
emails = extract_emails(text)
print(emails)
```

This code uses the `re` module to define a regular expression for matching email addresses, and then applies the `findall` method to the input text to obtain a list of all email occurrences. 

In the example, the `text` variable is set to the input text `'This is a text. sender@example.com'`. When we run the `extract_emails` function on this input, it returns a list containing the email address found in the text: `['sender@example.com']`.

Please note that this script works for most common use cases, but may not cover all possible email formats.
Complete the following task based on the instruction and optional input provided.### Instruction:
Write a python program that extracts all emails from a text.

### Input:
This is a text. sender@example.com

### Output:
Here is sample Python code that can be used to extract all emails from a given text:

``` python
import re

def extract_emails(text):
    email_regex = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'
    emails = re.findall(email_regex, text)
    return emails

text = 'This is a text. sender@example.com'
emails = extract_emails(text)
print(emails)
```

This code uses the `re` module to define a regular expression for matching email addresses, and then applies the `findall` method to the input text to obtain a list of all email occurrences. 

In the example, the `text` variable is set to the input text `'This is a text. sender@example.com'`. When we run the `extract_emails` function on this input, it returns a list containing the email address found in the text: `['sender@example.com']`.

Please note that this script works for most common use cases, but may not cover all possible email formats.