def security(policy, app_secret):
validate(policy)<EOL>policy_enc = base64.urlsafe_b64encode(json.dumps(policy).encode('<STR_LIT:utf-8>'))<EOL>signature = hmac.new(app_secret.encode('<STR_LIT:utf-8>'),<EOL>policy_enc,<EOL>hashlib.sha256).hexdigest()<EOL>return {'<STR_LIT>': policy_enc, '<STR_LIT>': signature}<EOL>
Creates a valid signature and policy based on provided app secret and
parameters
```python
from filestack import Client, security

# a policy requires at least an expiry
policy = {'expiry': 56589012, 'call': ['read', 'store', 'pick']}
sec = security(policy, 'APP_SECRET')

client =  Client('API_KEY', security=sec)
```