Load the object from a given file like object in the given format.

def load_from_file_object(cls, fd, format=None):
        """ Load the object from a given file like object in the given format.
        """
        format = 'pickle' if format is None else format
        load = getattr(cls, "load_%s" % format, None)
        if load is None:
            raise ValueError("Unknown format '%s'." % format)
        return load(fd)