Generate an IRI as a hash of given information, or just make one up if None given
    idbase -- Base URI for generating links
    tint -- String that affects the sequence of IDs generated if sent None

    >>> from bibframe.contrib.datachefids import idgen
    >>> g = idgen(None)
    >>> next(g) #Or g.send(None)
    'gKNG1b7eySo'
    >>> next(g)
    'cXx7iv67-3E'
    >>> g.send('spam')
    'OZxOEos8e-k'
    >>> next(g)
    'mCFhsaWQ1_0'
    >>> g.send('spam')
    'OZxOEos8e-k'
    >>> g.send('eggs')
    'xQAd4Guk040'
    >>> g.send('')
    'AAAAAAAAAAA'

def idgen(idbase, tint=None, bits=64):
    '''
    Generate an IRI as a hash of given information, or just make one up if None given
    idbase -- Base URI for generating links
    tint -- String that affects the sequence of IDs generated if sent None

    >>> from bibframe.contrib.datachefids import idgen
    >>> g = idgen(None)
    >>> next(g) #Or g.send(None)
    'gKNG1b7eySo'
    >>> next(g)
    'cXx7iv67-3E'
    >>> g.send('spam')
    'OZxOEos8e-k'
    >>> next(g)
    'mCFhsaWQ1_0'
    >>> g.send('spam')
    'OZxOEos8e-k'
    >>> g.send('eggs')
    'xQAd4Guk040'
    >>> g.send('')
    'AAAAAAAAAAA'
    '''
    counter = -1
    to_hash = None
    while True:
        if to_hash is None:
            to_hash = str(counter)
            if tint: to_hash += tint
        to_hash = simple_hashstring(to_hash, bits=bits)
        to_hash = yield iri.absolutize(to_hash, idbase) if idbase else to_hash
        counter += 1