Given a valid config, update the replication configuration for a bucket.

    Returns {updated: true} if replication configuration was updated and returns
    {updated: False} if replication configuration was not updated.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_s3_bucket.put_replication my_bucket my_role [...]

def put_replication(Bucket, Role, Rules,
           region=None, key=None, keyid=None, profile=None):
    '''
    Given a valid config, update the replication configuration for a bucket.

    Returns {updated: true} if replication configuration was updated and returns
    {updated: False} if replication configuration was not updated.

    CLI Example:

    .. code-block:: bash

        salt myminion boto_s3_bucket.put_replication my_bucket my_role [...]

    '''

    try:
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
        Role = _get_role_arn(name=Role,
                             region=region, key=key, keyid=keyid, profile=profile)
        if Rules is None:
            Rules = []
        elif isinstance(Rules, six.string_types):
            Rules = salt.utils.json.loads(Rules)
        conn.put_bucket_replication(Bucket=Bucket, ReplicationConfiguration={
                'Role': Role,
                'Rules': Rules
        })
        return {'updated': True, 'name': Bucket}
    except ClientError as e:
        return {'updated': False, 'error': __utils__['boto3.get_error'](e)}