Reads and returns the contents of a text file

def _read_file(path):
    '''
    Reads and returns the contents of a text file
    '''
    try:
        with salt.utils.files.fopen(path, 'rb') as contents:
            return salt.utils.yaml.safe_load(contents)
    except (OSError, IOError):
        return {}