code: def resolve_import(import_path, from_module):
      '''Resolves relative imports from a module.
      '''
      if not import_path or not import_path.startswith('.'):
          return import_path
  
      from_module = from_module.split('.')
      dots = 0
      for c in import_path:
          if c == '.':
              dots += 1
          else:
              break
  
      if dots:
          from_module = from_module[:-dots]
          import_path = import_path[dots:]
  
      if import_path:
          from_module.append(import_path)
  
      return '.'.join(from_modulef resolve_import(import_path, from_module):
      '''Resolves relative imports from a module.
      '''
      if not import_path or not import_path.startswith('.'):
          return import_path
  
      from_module = from_module.split('.')
      dots = 0
      for c in import_path:
          if c == '.':
              dots += 1
          else:
              break
  
      if dots:
          from_module = from_module[:-dots]
          import_path = import_path[dots:]
  
      if import_path:
          from_module.append(import_path)
  
      return '.'.join(from_module)
docs: Resolves relative imports from a module.