def get_lib_var(string):
    """Returns "lib" and "varname" for a given string of either "varname" or
    "lib.varname" form; lib defaults to None.
    String will often take the form "foo.fasta.some fasta block", in which case
    this function will return ("foo.fasta", "some fasta block"), as splitting
    commences from the right side of the string and stops after the first period
    it encounters."""
    lib, varname = None, None
    if '.' in string:
        lib, varname = string.rsplit('.', 1)
    else:
        varname = string
    return lib, varname
