module Pry::Helpers::CommandHelpers

def get_method_or_raise(method_name, context, opts = {})

def get_method_or_raise(method_name, context, opts = {})
  method = Pry::Method.from_str(method_name, context, opts)
  if !method && method_name
    raise Pry::MethodNotFound, "method '#{method_name}' could not be found."
  end
  (opts[:super] || 0).times do
    if method.super
      method = method.super
    else
      raise Pry::MethodNotFound,
            "'#{method.name_with_owner}' has no super method"
    end
  end
  if !method || (!method_name && internal_binding?(context))
    raise Pry::MethodNotFound,
          'no method name given, and context is not a method'
  end
  set_file_and_dir_locals(method.source_file)
  method
end