def extract_smali_method(method_name, smali_file):
    """
    Extracts a smali method from a smali file

    :param str method_name: the method to be extracted
    :param str smali_file: the file to extract the method from
    :return: the extracted method or empty string if not found
    """
    with open(smali_file, "r") as fd:
        smali_code = fd.read()

    smali_method = ""
    for line in smali_code.split("\n"):
        # if method has been found and end is in line
        if smali_method and ".end method" in line:
            return smali_method

        # if method has been found then start saving
        elif ".method" in line and method_name in line and not smali_method:
            smali_method = line

        elif smali_method:
            smali_method += "{}\n".format(line)

    return smali_method