import importlib


def import_symbol(typename):
    """Import a module or typename within a module from its name."""
    try:
        return importlib.import_module(typename)

    except ImportError as e:
        parts = typename.split('.')
        if len(parts) > 1:
            typename = parts.pop()

            # Call import_module recursively.
            namespace = import_symbol('.'.join(parts))

            try:
                return getattr(namespace, typename)
            except AttributeError:
                pass
        raise e

    except:
        raise


def make_object(*args, typename, **kwds):
    """Make an object from a symbol."""
    return import_symbol(typename)(*args, **kwds)

import importlib


def import_symbol(typename, package=None):
    """Import a module or typename within a module from its name."""
    try:
        return importlib.import_module(typename, package=package)

    except ImportError as e:
        parts = typename.split('.')
        if len(parts) > 1:
            typename = parts.pop()

            # Call import_module recursively.
            namespace = import_symbol('.'.join(parts), package=package)

            try:
                return getattr(namespace, typename)
            except AttributeError:
                pass
        raise e

    except:
        raise


def make_object(*args, typename, package=None, **kwds):
    """Make an object from a symbol."""
    return import_symbol(typename, package)(*args, **kwds)

Add a package argument to import_symbol.
Add a package argument to import_symbol.

  import importlib
  
  
- def import_symbol(typename):
+ def import_symbol(typename, package=None):
      """Import a module or typename within a module from its name."""
      try:
-         return importlib.import_module(typename)
+         return importlib.import_module(typename, package=package)
  
      except ImportError as e:
          parts = typename.split('.')
          if len(parts) > 1:
              typename = parts.pop()
  
              # Call import_module recursively.
-             namespace = import_symbol('.'.join(parts))
+             namespace = import_symbol('.'.join(parts), package=package)
  
              try:
                  return getattr(namespace, typename)
              except AttributeError:
                  pass
          raise e
  
      except:
          raise
  
  
- def make_object(*args, typename, **kwds):
+ def make_object(*args, typename, package=None, **kwds):
      """Make an object from a symbol."""
-     return import_symbol(typename)(*args, **kwds)
+     return import_symbol(typename, package)(*args, **kwds)
  
Add a package argument to import_symbol.
## Code Before:
import importlib


def import_symbol(typename):
    """Import a module or typename within a module from its name."""
    try:
        return importlib.import_module(typename)

    except ImportError as e:
        parts = typename.split('.')
        if len(parts) > 1:
            typename = parts.pop()

            # Call import_module recursively.
            namespace = import_symbol('.'.join(parts))

            try:
                return getattr(namespace, typename)
            except AttributeError:
                pass
        raise e

    except:
        raise


def make_object(*args, typename, **kwds):
    """Make an object from a symbol."""
    return import_symbol(typename)(*args, **kwds)

## Instruction:
Add a package argument to import_symbol.
## Code After:
import importlib


def import_symbol(typename, package=None):
    """Import a module or typename within a module from its name."""
    try:
        return importlib.import_module(typename, package=package)

    except ImportError as e:
        parts = typename.split('.')
        if len(parts) > 1:
            typename = parts.pop()

            # Call import_module recursively.
            namespace = import_symbol('.'.join(parts), package=package)

            try:
                return getattr(namespace, typename)
            except AttributeError:
                pass
        raise e

    except:
        raise


def make_object(*args, typename, package=None, **kwds):
    """Make an object from a symbol."""
    return import_symbol(typename, package)(*args, **kwds)
