code: def from_file(cls, source):
          
          if hasattr(source, 'read'):
              relations = cls.from_string(source.read())
          else:
              with open(source) as f:
                  relations = cls.from_string(f.read())
          return relations
docs: Instantiate Relations from a relations file.