docs: def from_dict(cls, dictionary):
          """Create a Berksfile instance from a dict."""
          cookbooks = set()
          sources = set()
          other = set()
          # put these in order
          groups = [sources, cookbooks, other]
  
          for key, val in dictionary.items():
              if key == 'cookbook':
                  cookbooks.update({cls.cookbook_statement(cbn, meta)
                                    for cbn, meta in val.items()})
              elif key == 'source':
                  sources.update({"source '%s'" % src for src in val})
              elif key == 'metadata':
                  other.add('metadata')
  
          body = ''
          for group in groups:
              if group:
                  body += '\n'
              body += '\n'.join(group)
          return cls.from_string(body)