Returns a dict pdb_id -> chain(s) -> chain and SCOPe details.
            This returns Pfam-level information for a PDB chain i.e. no details on the protein, species, or domain will be returned.
            If there are SCOPe entries for the associated Pfam accession numbers which agree then this function returns
            pretty complete information.

def get_chain_details_by_pfam(self, pdb_id, chain = None):
        ''' Returns a dict pdb_id -> chain(s) -> chain and SCOPe details.
            This returns Pfam-level information for a PDB chain i.e. no details on the protein, species, or domain will be returned.
            If there are SCOPe entries for the associated Pfam accession numbers which agree then this function returns
            pretty complete information.
        '''
        pfam_api = self.get_pfam_api()
        if chain:
            pfam_accs = pfam_api.get_pfam_accession_numbers_from_pdb_chain(pdb_id, chain)
            if pfam_accs:
                pfam_accs = {chain : pfam_accs}
        else:
            pfam_accs = pfam_api.get_pfam_accession_numbers_from_pdb_id(pdb_id)

        if not pfam_accs:
            # There were no associated Pfam accession numbers so we return
            return None

        d = {}
        for chain_id, pfam_acc_set in pfam_accs.iteritems():
            family_details = []
            for pfam_accession in pfam_acc_set:
                family_details.append(self.get_pfam_details(pfam_accession))

            family_details = [f for f in family_details if f]
            if not family_details:
                if self.fallback_on_failures:
                    # Fallback - There were no associated SCOPe entries with the associated Pfam accession numbers so we will
                    #            search all PDB chains associated with those Pfam accession numbers instead
                    d[chain_id] = self.get_chain_details_by_related_pdb_chains(pdb_id, chain_id, pfam_accs.get(chain_id))
                else:
                    d[chain_id] = None
                continue

            # Get the common SCOPe fields. For the sccs class, we take the longest common prefix


            d[chain_id] = self.get_basic_pdb_chain_information(pdb_id, chain_id)
            d[chain_id].update(self.get_common_fields(family_details))
            d[chain_id].update(dict(
                SCOPe_sources = 'Pfam + SCOPe',
                SCOPe_search_fields = 'Pfam + link_pfam.pfam_accession',
                SCOPe_trust_level = 2
            ))
            # Add the lowest common classification over all related Pfam families
            for k, v in sorted(self.levels.iteritems()):
                d[chain_id][v] = None
            d[chain_id].update(dict(self.get_common_hierarchy(family_details)))
        return d