code: def ast_from_file(self, filepath, modname=None, fallback=True, source=False):
          
          try:
              filepath = modutils.get_source_file(filepath, include_no_ext=True)
              source = True
          except modutils.NoSourceFile:
              pass
          if modname is None:
              try:
                  modname = ".".join(modutils.modpath_from_file(filepath))
              except ImportError:
                  modname = filepath
          if (
              modname in self.astroid_cache
              and self.astroid_cache[modname].file == filepath
          ):
              return self.astroid_cache[modname]
          if source:
              from astroid.builder import AstroidBuilder
  
              return AstroidBuilder(self).file_build(filepath, modname)
          if fallback and modname:
              return self.ast_from_module_name(modname)
          raise exceptions.AstroidBuildingError(
              "Unable to build an AST for {path}.", path=filepath
          )
docs: given a module name, return the astroid object