def get_pipeline_execute_url(environment: str, enterprise_id: str,
    pipeline_id: str, execute_id: str=None, action: str=None) ->str:
    """
    Build and return pipeline Execute url for scapi endpoint
    :param environment:
    :param enterprise_id:
    :param pipeline_id:
    :param execute_id:
    :param action:
    :return: Url
    """
    url = (
        f'https://{environment}-api.esper.cloud/api/v1/enterprise/{enterprise_id}/pipeline/{pipeline_id}/execute/'
        )
    if execute_id:
        url = f'{url}{execute_id}/'
        if action:
            url = f'{url}{action}/'
    return url
