def primary_key(self, hkey, rkey=None):
if isinstance(hkey, dict):<EOL><INDENT>def decode(val):<EOL><INDENT>"""<STR_LIT>"""<EOL>if isinstance(val, Decimal):<EOL><INDENT>return float(val)<EOL><DEDENT>return val<EOL><DEDENT>pkey = {self.hash_key.name: decode(hkey[self.hash_key.name])}<EOL>if self.range_key is not None:<EOL><INDENT>pkey[self.range_key.name] = decode(hkey[self.range_key.name])<EOL><DEDENT>return pkey<EOL><DEDENT>else:<EOL><INDENT>pkey = {self.hash_key.name: hkey}<EOL>if self.range_key is not None:<EOL><INDENT>if rkey is None:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>pkey[self.range_key.name] = rkey<EOL><DEDENT>return pkey<EOL><DEDENT>
Construct a primary key dictionary

You can either pass in a (hash_key[, range_key]) as the arguments, or
you may pass in an Item itself