Use only prefix OR suffix

    :param arn:
    :param event:
    :param bucket:
    :param prefix:
    :param suffix:
    :return:
488389
def _lambda_add_s3_event_source(awsclient, arn, event, bucket, prefix,
                                suffix):
    
    json_data = {
        'LambdaFunctionConfigurations': [{
            'LambdaFunctionArn': arn,
            'Id': str(uuid.uuid1()),
            'Events': [event]
        }]
    }

    filter_rules = build_filter_rules(prefix, suffix)

    json_data['LambdaFunctionConfigurations'][0].update({
        'Filter': {
            'Key': {
                'FilterRules': filter_rules
            }
        }
    })
    # http://docs.aws.amazon.com/cli/latest/reference/s3api/put-bucket-notification-configuration.html
    # http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html
    client_s3 = awsclient.get_client('s3')

    bucket_configurations = client_s3.get_bucket_notification_configuration(
        Bucket=bucket)
    bucket_configurations.pop('ResponseMetadata')

    if 'LambdaFunctionConfigurations' in bucket_configurations:
        bucket_configurations['LambdaFunctionConfigurations'].append(
            json_data['LambdaFunctionConfigurations'][0]
        )
    else:
        bucket_configurations['LambdaFunctionConfigurations'] = json_data[
            'LambdaFunctionConfigurations']

    response = client_s3.put_bucket_notification_configuration(
        Bucket=bucket,
        NotificationConfiguration=bucket_configurations
    )
    # TODO don't return a table, but success state
    return json2table(response)
1147904
def watch_prefix_once(self, key_prefix, timeout=None, **kwargs):
        
        kwargs['range_end'] = \
            utils.increment_last_byte(utils.to_bytes(key_prefix))
        return self.watch_once(key_prefix, timeout=timeout, **kwargs)
933024
def shared_prefix(args):
    
    i = 0
    while i < min(map(len, args)):
        if len(set(map(operator.itemgetter(i), args))) != 1:
            break
        i += 1
    return args[0][:i]
325095
def set_prefix(self, elt, pyobj):
        '''
        '''
        if isinstance(pyobj, tuple):
            namespaceURI,localName = pyobj
            self.prefix = elt.getPrefix(namespaceURI)
113774
def prefix=(value)
      value.is_a?(Prefix) ? super(value) : super(Prefix.find(value.to_s))
    end
1373546
def add_prefix(self, prefix, flags, prf):
        
        self._req('prefix add %s %s %s' % (prefix, flags, prf))
        time.sleep(1)
        self._req('netdataregister')
42043
def extend_name(suffix):
    

    def dec(cls):
        name = '{}{}'.format(cls.__name__, suffix)
        setattr(cls, '__name__', name)
        return cls

    return dec
611502
def index(self, prefix):
        
        # Any web domain will be handled by the standard URLField.
        if self.is_external_url_prefix(prefix):
            prefix = 'http'

        for i, urltype in enumerate(self._url_types):
            if urltype.prefix == prefix:
                return i
        return None
1210017
def explode(prefix: str):
    
    def _app(i, e=None):
        if i is not None:
            return {k: v for (k, v) in iter_fields(i)}, None
        return i, e

    def iter_fields(event_field: Union[dict, list]):
        if type(event_field) is dict:
            for key, val in event_field.items():
                yield (key, val)
        elif type(event_field) is list:
            for i, value in enumerate(event_field):
                for key, val in value.items():
                    if not i == 0:
                        yield ("{}_{}".format(key, i), val)
                    else:
                        yield (key, val)

    return compose(_app, add_column_prefix(prefix))
970489
function asyncLog(prefix) {
    return function(err,value) {
        if (err) {
            console.warn("Error getting "+prefix+': '+err, err.stack)
        } else {
            console.log(prefix+':',value)
        }
    }
}
8760
def prefixedname_to_iriref(self, prefix: ShExDocParser.PrefixedNameContext) -> ShExJ.IRIREF:
        
        return ShExJ.IRIREF(self.prefixedname_to_str(prefix))
303973
def lchop(string, prefix):
    
    if string.startswith(prefix):
        return string[len(prefix):]
    return string
689556
def ivorn_prefix_present(session, ivorn_prefix):
    
    n_matches = session.query(Voevent.ivorn).filter(
            Voevent.ivorn.like('{}%'.format(ivorn_prefix))).count()
    return bool(n_matches)
731301
def get_event_source(prefix):
    
    source = LRR_EVENT_TYPE.UNKNOWN

    if prefix == 'CID':
        source = LRR_EVENT_TYPE.CID
    elif prefix == 'DSC':
        source = LRR_EVENT_TYPE.DSC
    elif prefix == 'AD2':
        source = LRR_EVENT_TYPE.ALARMDECODER
    elif prefix == 'ADEMCO':
        source = LRR_EVENT_TYPE.ADEMCO

    return source
22936
def followingPrefix(prefix):
        """"""
        prefixBytes = array('B', prefix)

        changeIndex = len(prefixBytes) - 1
        while (changeIndex >= 0 and prefixBytes[changeIndex] == 0xff ):
            changeIndex = changeIndex - 1;
        if(changeIndex < 0):
            return None
        newBytes = array('B', prefix[0:changeIndex + 1])
        newBytes[changeIndex] = newBytes[changeIndex] + 1
        return newBytes.tostring()
462478
def strnum(prefix: str, num: int, suffix: str = "") -> str:
    
    return "{}{}{}".format(prefix, num, suffix)
1027416
def strip_optional_prefix(string, prefix, log=None):
    
    if string.startswith(prefix):
        return string[len(prefix):]
    if log:
        log.warn('String starts with %r, not %r', string[:len(prefix)], prefix)
    return string