human
Give me a Python code to read a yaml file and serialize it.
assistant
Here is a Python code to read a yaml file and serialize it

import yaml

def read_yaml_file(filename):
    """Reads a yaml file and returns a dictionary."""
    with open(filename, 'r') as stream:
        try:
            return yaml.safe_load(stream)
        except yaml.YAMLError as exc:
            print(exc)

# Enter the filename
filename = "test.yaml"

# Calling the function
dictionary = read_yaml_file(filename)

# Printing the dictionary
print(dictionary)

#Example Output
# Hello

#Remember to inspect code for bugs.