Find  **stages** in document.

    Args:
        document (dict): validated spline document loaded from a yaml file.

    Returns:
        list: stages as a part of the spline document or an empty list if not given.

    >>> find_stages({'pipeline': [{'stage(Prepare)':1}, {'stage(Build)':1}, {'stage(Deploy)':2}]})
    ['Prepare', 'Build', 'Deploy']

def find_stages(document):
    """
    Find  **stages** in document.

    Args:
        document (dict): validated spline document loaded from a yaml file.

    Returns:
        list: stages as a part of the spline document or an empty list if not given.

    >>> find_stages({'pipeline': [{'stage(Prepare)':1}, {'stage(Build)':1}, {'stage(Deploy)':2}]})
    ['Prepare', 'Build', 'Deploy']
    """
    names = []
    if 'pipeline' in document:
        for entry in document['pipeline']:
            # each entry is dictionary with one key only
            key, _ = list(entry.items())[0]
            if key.startswith("stage("):
                names.append(key.replace('stage(', '').replace(')', ''))
    return names