def relative_abundance(biomf, sampleIDs=None):
    """
    Calculate the relative abundance of each OTUID in a Sample.

    :type biomf: A BIOM file.
    :param biomf: OTU table format.

    :type sampleIDs: list
    :param sampleIDs: A list of sample id's from BIOM format OTU table.

    :rtype: dict
    :return: Returns a keyed on SampleIDs, and the values are dictionaries keyed on
             OTUID's and their values represent the relative abundance of that OTUID in
             that SampleID.
    """
    if sampleIDs is None:
        sampleIDs = biomf.ids()
    else:
        try:
            for sid in sampleIDs:
                assert sid in biomf.ids()
        except AssertionError:
            raise ValueError(
                "\nError while calculating relative abundances: The sampleIDs provided do"
                " not match the sampleIDs in biom file. Please double check the sampleIDs"
                " provided.\n")
    otuIDs = biomf.ids(axis="observation")
    norm_biomf = biomf.norm(inplace=False)

    return {sample: {otuID: norm_biomf.get_value_by_ids(otuID, sample)
                     for otuID in otuIDs} for sample in sampleIDs}