def to_fixed(s, prec):
    sign, man, exp, bc = s
    offset = exp + prec
    if sign:
        if offset >= 0: return (-man) << offset
        else:           return (-man) >> (-offset)
    else:
        if offset >= 0: return man << offset
        else:           return man >> (-offset)


##############################################################################
##############################################################################

#----------------------------------------------------------------------------#
#                       Arithmetic operations, etc.                          #
#----------------------------------------------------------------------------#
The receive username and topic title should be escaped
dataset/ETHPy150Open fredrik-johansson/mpmath/mpmath/libmp/libmpf.py/to_fixed--crossover with--dataset/ETHPy150Open nitely/Spirit/spirit/topic/notification/tests.py/TopicNotificationViewTest.test_topic_notification_ajax_escape