def BLASTcheck(rid,baseURL="http://blast.ncbi.nlm.nih.gov"):
    """
    Checks the status of a query.

    :param rid: BLAST search request identifier. Allowed values: The Request ID (RID) returned when the search was submitted
    :param baseURL: server url. Default=http://blast.ncbi.nlm.nih.gov

    :returns status: status for the query.
    :returns therearehist: yes or no for existing hits on a finished query.
    """

    URL=baseURL+"/Blast.cgi?"
    URL=URL+"FORMAT_OBJECT=SearchInfo&RID="+rid+"&CMD=Get"
    response=requests.get(url = URL)
    r=response.content.split("\n")
    try:
        status=[ s for s in r if "Status=" in s ][0].split("=")[-1]
        ThereAreHits=[ s for s in r if "ThereAreHits=" in s ][0].split("=")[-1]
    except:
        status=None
        ThereAreHits=None

    print(rid, status, ThereAreHits)
    sys.stdout.flush()

    return status, ThereAreHits
Checks the status of a query.

    :param rid: BLAST search request identifier. Allowed values: The Request ID (RID) returned when the search was submitted
    :param baseURL: server url. Default=http://blast.ncbi.nlm.nih.gov

    :returns status: status for the query.
    :returns therearehist: yes or no for existing hits on a finished query.