def IdToCounter(k):
 if (k > _MAX_SCATTERED_ID):
  return (0, SCATTERED)
 elif ((k > _MAX_SEQUENTIAL_ID) and (k <= _MAX_SCATTERED_ID)):
  return (long((ReverseBitsInt64(k) >> _SCATTER_SHIFT)), SCATTERED)
 elif (k > 0):
  return (long(k), SEQUENTIAL)
 else:
  raise datastore_errors.BadArgumentError(('invalid id (%d)' % k))

def IdToCounter ( k ) : if ( k > _MAX_SCATTERED_ID ) : return ( 0 , SCATTERED ) elif ( ( k > _MAX_SEQUENTIAL_ID ) and ( k <= _MAX_SCATTERED_ID ) ) : return ( long ( ( ReverseBitsInt64 ( k ) >> _SCATTER_SHIFT ) ) , SCATTERED ) elif ( k > 0 ) : return ( long ( k ) , SEQUENTIAL ) else : raise datastore_errors . BadArgumentError ( ( 'invalid id (%d)' % k ) )
map id k to the counter value from which it was generated .