<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def list_pipelines(region=None, key=None, keyid=None, profile=None):
    '''
    Get a list of pipeline ids and names for all pipelines.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_datapipeline.list_pipelines profile=myprofile
    '''
    client = _get_client(region, key, keyid, profile)
    r = {}
    try:
        paginator = client.get_paginator('list_pipelines')
        pipelines = []
        for page in paginator.paginate():
            pipelines += page['pipelineIdList']
        r['result'] = pipelines
    except (botocore.exceptions.BotoCoreError, botocore.exceptions.ClientError) as e:
        r['error'] = six.text_type(e)
    return r