def intify(obj, str_fun=str, use_ord=True, use_hash=True, use_len=True):
try:<EOL><INDENT>return int(obj)<EOL><DEDENT>except (IndexError, ValueError, AttributeError, TypeError):<EOL><INDENT>pass<EOL><DEDENT>try:<EOL><INDENT>float_obj = float(obj)<EOL>if float('<STR_LIT>') < float_obj < float('<STR_LIT>'):<EOL><INDENT>return int(float_obj)<EOL><DEDENT><DEDENT>except (IndexError, ValueError, AttributeError, TypeError):<EOL><INDENT>pass<EOL><DEDENT>if not str_fun:<EOL><INDENT>def str_fun(x):<EOL><INDENT>return x<EOL><DEDENT><DEDENT>if use_ord:<EOL><INDENT>try:<EOL><INDENT>return ord(str_fun(obj)[<NUM_LIT:0>].lower())<EOL><DEDENT>except (IndexError, ValueError, AttributeError, TypeError):<EOL><INDENT>pass<EOL><DEDENT><DEDENT>if use_hash:<EOL><INDENT>try:<EOL><INDENT>return hash(str_fun(obj))<EOL><DEDENT>except (IndexError, ValueError, AttributeError, TypeError):<EOL><INDENT>pass<EOL><DEDENT><DEDENT>if use_len:<EOL><INDENT>try:<EOL><INDENT>return len(obj)<EOL><DEDENT>except (IndexError, ValueError, AttributeError, TypeError):<EOL><INDENT>pass<EOL><DEDENT>try:<EOL><INDENT>return len(str_fun(obj))<EOL><DEDENT>except (IndexError, ValueError, AttributeError, TypeError):<EOL><INDENT>pass<EOL><DEDENT><DEDENT>return None<EOL>
FIXME: this is unpythonic and does things you don't expect!

    FIXME: rename to "integer_from_category"

    Returns an integer representative of a categorical object (string, dict, etc)

    >>> intify('1.2345e10')
    12345000000
    >>> intify([12]), intify('[99]'), intify('(12,)')
    (91, 91, 40)
    >>> intify('A'), intify('a'), intify('AAA'), intify('B'), intify('BB')
    (97, 97, 97, 98, 98)
    >>> intify(272)
    272
    >>> intify(float('nan'), use_ord=False, use_hash=False, str_fun=None)
    >>> intify(float('nan'), use_ord=False, use_hash=False, use_len=False)
    >>> intify(float('nan')), intify('n'), intify(None)
    (110, 110, 110)
    >>> intify(None, use_ord=False, use_hash=False, use_len=False)
    >>> intify(None, use_ord=False, use_hash=False, str_fun=False)
    >>> intify(None, use_hash=False, str_fun=False)