Returns a dict to communicate with the server

        :param restrict_keys: a set of keys to restrict the returned data to
        :rtype: dict
765118
def to_api_data(self, restrict_keys=None):
        
        cc = self._cc  # alias
        data = {
            cc('column_width'): self._column_width,
            cc('horizontal_alignment'): self._horizontal_alignment,
            cc('row_height'): self._row_height,
            cc('vertical_alignment'): self._vertical_alignment,
            cc('wrap_text'): self._wrap_text,
        }

        if restrict_keys:
            for key in list(data.keys()):
                if key not in restrict_keys:
                    del data[key]
        return data
19549
def get_keypair_dict():
  """"""

  client = get_ec2_client()
  response = client.describe_key_pairs()
  assert is_good_response(response)

  result = {}
  ec2 = get_ec2_resource()
  for keypair in response['KeyPairs']:
    keypair_name = keypair.get('KeyName', '')
    if keypair_name in result:
      util.log(f"Warning: Duplicate key {keypair_name}")
    if DUPLICATE_CHECKING:
      assert keypair_name not in result, "Duplicate key " + keypair_name
    result[keypair_name] = ec2.KeyPair(keypair_name)
  return result
1142859
def filter_keys(cls, data):
        
        keys = list(data.keys())
        for pattern in cls.EXCLUDE_PATTERNS:
            for key in keys:
                if re.match(pattern, key):
                    keys.remove(key)
        return dict(filter(lambda x: x[0] in keys, data.items()))
1349391
def restrict(d,restrict):
    '''
    
    '''
    notqs = ['t','xs','ys','zs','fd','sd']
    keys  = [k for k in d if k not in notqs];
    if len(restrict) == 2:
        for k in keys:
            d[k] = d[k][restrict[0]:restrict[1]]
    elif len(restrict) == 4:
        for k in keys:
            d[k] = d[k][
                restrict[0]:restrict[1],
                restrict[2]:restrict[3]
            ];
    elif len(restrict) == 6:
        for k in keys:
            d[k] = d[k][
                restrict[0]:restrict[1],
                restrict[2]:restrict[3],
                restrict[4]:restrict[5]
            ];
    else:
        raise ValueError("restrict of length {} is not valid".format(
            len(restrict)));
722028
def to_api_data(self, restrict_keys=None):
        
        cc = self._cc  # alias
        data = {
            cc('subject'): self.__subject,
            cc('body'): {
                cc('contentType'): self.body_type,
                cc('content'): self.__body},
            cc('start'): self._build_date_time_time_zone(self.__start),
            cc('end'): self._build_date_time_time_zone(self.__end),
            cc('attendees'): self.__attendees.to_api_data(),
            cc('location'): {cc('displayName'): self.__location},
            cc('categories'): self.__categories,
            cc('isAllDay'): self.__is_all_day,
            cc('importance'): cc(self.__importance.value),
            cc('isReminderOn'): self.__is_reminder_on,
            cc('reminderMinutesBeforeStart'): self.__remind_before_minutes,
            cc('responseRequested'): self.__response_requested,
            cc('sensitivity'): cc(self.__sensitivity.value),
            cc('showAs'): cc(self.__show_as.value),
        }

        if self.__recurrence:
            data[cc('recurrence')] = self.__recurrence.to_api_data()

        if self.has_attachments:
            data[cc('attachments')] = self.__attachments.to_api_data()

        if restrict_keys:
            for key in list(data.keys()):
                if key not in restrict_keys:
                    del data[key]
        return data
229041
def _filter_keys(d: dict, keys: set) -> dict:
        
        return {key: d[key] for key in keys if key in d}
771210
def get_all_keys(self, headers=None, **params):
        
        key = Key(self.name, self.contained_key)
        return SimpleResultSet([key])
1144032
def keys(self):
        
        for field in self._client.hkeys(self.key_prefix):
            yield self._decode(field)
1151822
def get_s3_bucket_keys(api_client, bucket_name, bucket, check_encryption, check_acls):
    
    bucket['keys'] = []
    keys = handle_truncated_response(api_client.list_objects, {'Bucket': bucket_name}, ['Contents'])
    bucket['keys_count'] = len(keys['Contents'])
    key_count = 0
    update_status(key_count, bucket['keys_count'], 'keys')
    for key in keys['Contents']:
        key_count += 1
        key['name'] = key.pop('Key')
        key['LastModified'] = str(key['LastModified'])
        if check_encryption:
            try:
                # The encryption configuration is only accessible via an HTTP header, only returned when requesting one object at a time...
                k = api_client.get_object(Bucket = bucket_name, Key = key['name'])
                key['ServerSideEncryption'] = k['ServerSideEncryption'] if 'ServerSideEncryption' in k else None
                key['SSEKMSKeyId'] = k['SSEKMSKeyId'] if 'SSEKMSKeyId' in k else None
            except Exception as e:
                printException(e)
                continue
        if check_acls:
            try:
                key['grantees'] = get_s3_acls(api_client, bucket_name, bucket, key_name = key['name'])
            except Exception as e:
                continue
        # Save it
        bucket['keys'].append(key)
        update_status(key_count, bucket['keys_count'], 'keys')
882739
def _filter_config(self, config, fields=None):
        
        filter_fields_default = [
            'bind_password',
            'connection'
            ]

        filter_fields = fields or filter_fields_default
        return dict(
            map(
                lambda key: (key, '<hidden>' if key in filter_fields else config[key]),
                config.keys()
                )
            )
1066968
def load(self):
        
        session_data = {}
        try:
            session_data = decode(self.session_key,
                settings.DJAODJIN_SECRET_KEY)
            self._session_key_data.update(session_data)
            LOGGER.debug("session data (from proxy): %s", session_data)
            # We have been able to decode the session data, let's
            # create Users and session keys expected by Django
            # contrib.auth backend.
            if 'username' in session_data:
                user = authenticate(
                    request=session_data, remote_user=session_data['username'])
                if not user:
                    raise ValueError("Cannot authenticate user.")
                session_data[SESSION_KEY] = user.id
                session_data[BACKEND_SESSION_KEY] = user.backend
                session_data[HASH_SESSION_KEY] = user.get_session_auth_hash()
                if self._local:
                    session_data_local = self._local.load()
                    LOGGER.debug("session data (local): %s", session_data_local)
                    session_data.update(session_data_local)
        except Exception as err: #pylint:disable=broad-except
            LOGGER.debug("error: while loading session, %s", err)
            return {}
        return session_data
567208
def data(self):
        
        d = {}
        for name in self.key_names:
            d[name] = self.__dict__.get(name, None)
        return d
24548
def ssh_keys(self):
        
        params = {}
        json = self.request('/ssh_keys', method='GET', params=params)
        status = json.get('status')
        if status == 'OK':
            ssh_keys_json = json.get('ssh_keys', [])
            keys = [SSHKey.from_json(ssh_key) for ssh_key in ssh_keys_json]
            return keys
        else:
            message = json.get('message')
            raise DOPException('[%s]: %s' % (status, message))
157826
def key(self, identifier=None, security_level=None):
        
        if identifier:
            try:
                return self._encryption_keys[identifier]
            except KeyError:
                pass
        if security_level:
            for key in self._encryption_keys.values():
                if key.level == security_level:
                    return key
1038907
def restrict_bond_dict(self, bond_dict):
        
        return {j: bond_dict[j] & set(self.index) for j in self.index}
446609
def getKey(self, key):
		
		data = self.getDictionary()
		if key in data:
			return data[key]
		else:
			return None
117467
def dict_pick(dictionary, allowed_keys):
    
    return {key: value for key, value in viewitems(dictionary) if key in allowed_keys}