def _get_secret_from_vault(<EOL>key, environment=None, stage=None, namespace=None,<EOL>wait_exponential_multiplier=<NUM_LIT:50>, wait_exponential_max=<NUM_LIT>,<EOL>stop_max_delay=<NUM_LIT>):
<EOL>table_name = _secrets_table_name(environment=environment, stage=stage)<EOL>if namespace:<EOL><INDENT>key = "<STR_LIT>".format(namespace, key)<EOL><DEDENT>if table_name is None:<EOL><INDENT>logger.warning("<STR_LIT>"<EOL>"<STR_LIT>".format(key))<EOL>return<EOL><DEDENT>client = boto3.client('<STR_LIT>')<EOL>logger.info("<STR_LIT>".format(<EOL>key, table_name))<EOL>@retry(retry_on_exception=_is_critical_exception,<EOL>wait_exponential_multiplier=wait_exponential_multiplier,<EOL>wait_exponential_max=wait_exponential_max,<EOL>stop_max_delay=stop_max_delay)<EOL>def get_item():<EOL><INDENT>try:<EOL><INDENT>return client.get_item(<EOL>TableName=table_name,<EOL>Key={'<STR_LIT:id>': {'<STR_LIT:S>': key}}).get('<STR_LIT>', {}).get(<EOL>'<STR_LIT:value>', {}).get('<STR_LIT:B>')<EOL><DEDENT>except Exception as err:<EOL><INDENT>if _is_dynamodb_critical_exception(err):<EOL><INDENT>raise CriticalError(err)<EOL><DEDENT>else:<EOL><INDENT>raise<EOL><DEDENT><DEDENT><DEDENT>encrypted = get_item()<EOL>if encrypted is None:<EOL><INDENT>return<EOL><DEDENT>client = boto3.client('<STR_LIT>')<EOL>try:<EOL><INDENT>value = client.decrypt(CiphertextBlob=encrypted)['<STR_LIT>'].decode()<EOL><DEDENT>except ClientError:<EOL><INDENT>logger.error("<STR_LIT>")<EOL>traceback.print_exc()<EOL>return<EOL><DEDENT>try:<EOL><INDENT>value = json.loads(value)<EOL><DEDENT>except (TypeError, ValueError):<EOL><INDENT>pass<EOL><DEDENT>return value<EOL>
Retrieves a secret from the secrets vault.