import yaml
import re


def read_yaml(file_path):
    """
    By Adam O'Hern for Mechanical Color

    Returns a Python object (list or dict, as appropriate) from a given YAML file path.
    We use YAML because it's easier and more human readable than JSON. It's harder to mess up,
    easier to learn, and--imagine!--it supports commenting.

    Note: YAML does not support hard tabs (\t), so this script replaces those with four spaces ('    ').
    """

    yaml_file = open(file_path, 'r')
    yaml_data = yaml.safe_load(re.sub('\\t', '    ', yaml_file.read()))

    yaml_file.close()
    return yaml_data