<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def as_string(self):
 """Return the command as a single string for the docker file"""

        if type(self.instruction) is str:
            return self.instruction

        if self.action == "FROM" and not isinstance(self.command, six.string_types):
            extra = "" if self.extra is NotSpecified else " {0}".format(self.extra)
            return "{0} {1}{2}".format(self.action, self.command.from_name, extra)
        else:
            return "{0} {1}".format(self.action, self.command)