import yaml


def check_tosca(path):
    """
    Opens a YAML file and determines if it is a tosca_script.
    
    Parameters
    ----------
    path : str : the path to the YAML file to check.
    Return
    ----------
    tosca : boolean : a boolean if the script is tosca or not.
    """

    if 'travis' in path:
        return False

    try:
        with open(path, 'r', encoding='utf8') as f:
            yml = f.read()

        yml = yaml.safe_load(yml)
        return 'tosca_definitions_version' in yml.keys()
        
    except:
        return False