def field_to_long(value):
        """
        Converts given value to long if possible, otherwise None is returned.

        :param value:
        :return:
        """
        if isinstance(value, (int, long)):
            return long(value)
        elif isinstance(value, basestring):
            return bytes_to_long(from_hex(value))
        else:
            return None
def field_to_long ( value ) : if isinstance ( value , ( int , long ) ) : return long ( value ) elif isinstance ( value , basestring ) : return bytes_to_long ( from_hex ( value ) ) else : return None
Converts given value to long if possible, otherwise None is returned.

        :param value:
        :return: