def get_method_from_command(d_args, command, method_name):
    """
    A recursive function that builds the method_name from the command.

    'gdk component init --lang python --template template-name'
    When the above command is parsed(parse_args), the following namespace is returned.
    Namespace(gdk='component', foo=None, component='init', init=None, lang='python', template='template-name')
    where,
    gdk -> component, component -> init, init -> None and we derive the method name from this as
    '_gdk_component_init'

    Parameters
    ----------
      d_args(dict): A dictionary object that contains parsed args namespace of a command.
      command(string): Command from the namespace that is appended to method name and is used to determine its subcommand
      method_name(string): Method name determined from the args namespace.

    Returns
    -------
      method_name(string): Method name determined from the args namespace. None if the command is invalid
    """
    method_name = "{}_{}".format(method_name, command)
    if command and command in d_args:
        if d_args[command] is None:
            return method_name
        return get_method_from_command(d_args, d_args[command], method_name)