Retrieves results for an RID.

    :param rid: BLAST search request identifier. Allowed values: The Request ID (RID) returned when the search was submitted
    :param format_type: Report type. Allowed values: HTML, Text, XML, XML2, JSON2, or Tabular. Tabular is the default.
    :param hitlist_size: Number of databases sequences to keep. Allowed values: Integer greater than zero.
    :param alignments: Number of alignments to print (applies to HTML and Text). Allowed values: Integer greater than zero.
    :param ncbi_gi: Show NCBI GIs in report. Allowed values: T or F.
    :param format_object: Object type. Allowed values: SearchInfo (status check) or Alignment (report formatting).
    :param baseURL: server url. Default=http://blast.ncbi.nlm.nih.gov

    :returns: the result of a BLAST query. If format_type="Tabular" it will parse the content into a Pandas dataframe.

def BLASTresults(rid, format_type="Tabular", \
                 hitlist_size= None, alignments=None, \
                 ncbi_gi = None, format_object=None,\
                 baseURL="http://blast.ncbi.nlm.nih.gov"):
    """
    Retrieves results for an RID.

    :param rid: BLAST search request identifier. Allowed values: The Request ID (RID) returned when the search was submitted
    :param format_type: Report type. Allowed values: HTML, Text, XML, XML2, JSON2, or Tabular. Tabular is the default.
    :param hitlist_size: Number of databases sequences to keep. Allowed values: Integer greater than zero.
    :param alignments: Number of alignments to print (applies to HTML and Text). Allowed values: Integer greater than zero.
    :param ncbi_gi: Show NCBI GIs in report. Allowed values: T or F.
    :param format_object: Object type. Allowed values: SearchInfo (status check) or Alignment (report formatting).
    :param baseURL: server url. Default=http://blast.ncbi.nlm.nih.gov

    :returns: the result of a BLAST query. If format_type="Tabular" it will parse the content into a Pandas dataframe.
    """

    URL=baseURL+"/Blast.cgi?"
    URL=URL+"RID="+str(rid)+"&FORMAT_TYPE="+str(format_type)
    for o in [ hitlist_size, alignments,\
              ncbi_gi, format_object]:
        if o:
            URL=URL+"&"+ variablename(var) +"="+str(o)
    URL=URL+"&CMD=Get"
    response=requests.get(url = URL)
    response=response.content

    if format_type=="Tabular":
        result=response.split("\n")
        result=[ s.split("\t") for s in result][6:]
        header=result[:7]
        content=result[7:]
        fields=header[5][0].strip("# Fields: ").split(", ")
        result=pd.DataFrame(content,columns=fields)
        response=result[:int(header[-1][0].split(" ")[1])]

    return response